rcorp / standard-project-structure

A mission to improve developer productivity. Automate Everything ™ !
Apache License 2.0
5 stars 3 forks source link

Standard Test Infrastructure #5

Open gaurav21r opened 8 years ago

gaurav21r commented 8 years ago
gaurav21r commented 8 years ago

This is a real gem for Client side Unit Testing: http://developer.telerik.com/featured/journey-client-side-testing-javascript/

riteshe63 commented 8 years ago

ok i am see this

gaurav21r commented 8 years ago

Based on a lot of research, these are some of my notes:

Test Frameworks

The Intern

  1. This comparison chart is very impressive! (Seems to be removed now)
  2. Unfortunately community participation is low.
  3. Usage is low especially in non dojo environments. (Subjective, but I took a rough market analysis of top npm projects etc.)
  4. Not so great (out of the box) for non AMD Environments.

Jasmine

  1. One of the most used frameworks out there second only to perhaps mocha.
  2. Facebook's jest is derived from jasmine and since its used in React I can see a resurgence for Jasmine.
  3. Second best choice if it weren't for mocha.

Mocha

  1. Used almost unanimously amongst top projects.
  2. Great community participation.
  3. Wonderfully easy to use OTB.

Tape

  1. Hearing the name a lot, seems that in some time it will steal the crown from mocha.
  2. Not enough maturity / community involvement ATM in comparison mocha.

Verdict : Mocha

Test Runner

mocha running under Node.js is the perfect runner for backend tests. For client side tests we have a few options:

PhantomJS

  1. Can run everything (both client and server tests) from the command line which is awesome!
  2. Has no support for ES6 :crying_cat_face: PhantomJS2 might but I couldn't get it to work!

Karma

  1. Really recommended everywhere for Real Browser Client side Testing.
  2. A bit difficult to setup at first.
  3. Plays really well mocha.

Verdict: Karma

Functional Tests

TODO

  1. Should we use Selenium or Karma for functional tests?
  2. If we are using Selenium should we use WD or leadoot ?

Resources

  1. A Journey Through Client-Side Testing with JavaScript
gaurav21r commented 7 years ago

I guess we've selected mocha as the primary test framework. Now we need to write documentation (and setup the infrastructure) for the following:

  1. How do I run all server unit tests in my repository together?
  2. How do I run a specific server unit test in my repository?
  3. How do I run all client unit tests in my repository together?
  4. How do I run a specific client unit test in my repository?

Not to mention get all the Code coverage for the above too!

cc @riteshe63 @prakash1517 @divya3103