-
Notifications
You must be signed in to change notification settings - Fork 56
Integrating with MCover Code Coverage
Dr-Emann edited this page Aug 21, 2012
·
5 revisions
MCover is a code coverage tool that generates coverage reports for your test classes.
See MassiveCover for more information
As of 0.9.2.0, MUnit has integrated support for MCover. To include coverage in your test reports, add the '-coverage' flag to the test command.
haxelib run munit test -coverage
The easiest thing is to generate a new munit project in an empty directory and copy the generated TestMain across
haxelib run munit config
To run coverage on older MUnit projects requires an update to both the .munit config and the TestMain.hx file in the current project.
- Add target source path(s) to .munit classPaths
- Add conditional #MCOVER flag in TestMain to use mcover's MCoverPrintClient.
Run
haxelib run munit config
And specify one or more target classPath(s)
Update the following in test/TestMain.hx:
var runner:TestRunner = new TestRunner(new PrintClient())
runner.addResultClient(httpClient);
With
#if MCOVER
var client = new m.cover.coverage.munit.client.MCoverPrintClient();
var httpClient = new HTTPClient(new m.cover.coverage.munit.client.MCoverSummaryReportClient());
#else
var client = new RichPrintClient();
var httpClient = new HTTPClient(new SummaryReportClient());
#end
var runner:TestRunner = new TestRunner(client);
runner.addResultClient(httpClient);