How to organize my JavaScript unit tests when using QUnit, PhantomJS and JSCover -


i trying set automated unit tests javascript code using phantomjs , qunit, , generate code coverage jscover - described here: http://julianhigman.com/blog/2013/07/23/testing-javascript-with-qunit-phantomjs-and-jscover/

the thing page, , others have seen on subject, assume have single html page load , run of qunit tests in project.

in case have 50 javascript source files, , corresponding .js unit test file each. going go down route of having separate html page per unit test file, during development run tests specific file in-browser individually. apart overhead of having maintain 50 (admittedly basic) html files, not sure how make work nicely jscover (without generating 50 coverage reports).

is best practice me include of 50 unit test files single html page?

i choose include 50 unit test files in single html page.

you can use qunit modules break tests groups if don't want run of tests of time. can run tests 1 module @ time using drop-down list @ top-right of qunit page or using query-string parameter in url, example http://localhost:8000/qunit-tests.html?module=somemodulename or file:///path/to/your/qunit-tests.html?module=somemodulename.

including 50 test files in same html page means can run of tests in 1 go , generate code coverage code. can't feel running phantomjs on 50 html pages 1 after other considerably slower running on 1 single larger html page.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -