Javascript unit testing: how do you track all the tests you wrote and what is your code coverage?

I write unit tests for an application, but it's hard for me to keep track of which scripts I tested in each method.

I am currently using qunit and creating a test directory for each object that I am testing with a module, and one file for each method that I am testing, but how do you get a good overview of all your tests in the digest?

Ideally, I would like to have something

  • which could run my unit tests and add a test description next to the function to which it relates, in the code itself, so when in the code I can immediately see the tests that I have for the method
  • have some kind of simple overview of all my tests.

Does anyone have any recommendations on tools or methods that can help solve this problem?

+5
source share
1 answer

The projects that I worked on were Server + Client projects, in which we had a set of unit tests for our server-side code, and we wanted to integrate our client-side tests into this process.

In this case, I wrote "Unit Test" in my server side code, which opened every QUnit test in the browser, then cleared the DOM for success / failure records and called Assert (false, text_scraped_from_dom). Then all my qUint tests were run as part of my CI build and showed up there as failed tests.

I did this for Java with httpunit and for .NET with watin.

0

All Articles