-
Notifications
You must be signed in to change notification settings - Fork 17
Running tests and checking coverage
Before you can run the tests and check the coverage yourself, you'll need to get your local development environment setup.
NOTE: From here on, this document will refer to
{source root}
as the directory into which you cloned the code. If you cloned into the default directory,{source root}
will end withdol-whd-14c
.
To run the tests for the backend code, open the DOL.WHD.Section14c.sln
solution in Visual Studio from the {source root}
directory. Build the solution, then open the test explorer and click "Run All." This will run all the tests and highlight any failures.
To get coverage metrics, you will need to open a terminal window, then:
cd {source root}\DOL.WHD.Section14c.Test
CodeCoverage.bat
This will build the solution and run the tests again, but this time with coverage instrumentation. When it is finished, it will create a code coverage report in HTML format at {source root}\DOL.WHD.Section14c.Test\CoverageReport\index.htm
. You can open that file in your favorite web browser to see the code coverage report.
It seems a little silly to have to do two steps of essentially the same thing, but the integrated test explorer does not capture code coverage, and the command-line tool does not report test failures.
To run tests and get coverage information for the frontend code, open a terminal window and then:
cd {source root}\DOL.WHD.Section14c.Web
npm test
This both runs the tests and collects code coverage metrics. The final report is generated in two formats: a standard LCOV format that can be submitted to coverage SaaS tools (like (codecov.io)[codecov.io], for example), and a proprietary HTML format. The easiest way to view the report is to open that HTML file in your browser. It is located at {source root}\DOL.WHD.Section14c.Web\coverage\lcov-report\index.html
.