In this post, I will show you how to generate test coverage reports using the JsTestDriver. First of all, Let’s understand what is meant by “Test Coverage”. “Test Coverage” is one of the measures of software testing. It describes how much the source code of the program is tested.
The coverage criteria can be on the function level (Function coverage), on the statement level (Statement coverage), and on the code branch level (Branch coverage).
Currently, The JsTestDriver generates the test coverage files in LCOV format. Unfortunately, JsTestDriver does not generate HTML reports directly as shown in the figure below.
To generate the HTML reports from the LCOV files, you can use the LCOV visualizer, check it here: http://ltp.sourceforge.net/coverage/lcov.php.
The LCOV visualizer tool is working on Linux Redhat environment. To generate the report from the tool, execute this command on the
For more information about how to install the LCOV visualizer on Linux Redhat environment, and converting the LCOV files to HTML reports:
Finally for your reference, You can download the project from here, and the LCOV test coverage files from here.
I wish that this tip can be useful.