Covering MSTest on your Build Server
A good solution for covering MSTest on your build server is the NCover Run command:
- First, create an NCover project.
- On the "Processes" tab, name your project, then click "Edit Match Rules."
- Add a match rule of Match type="Regex", Process matching="qtagent." This is all that's required to get started.
- Save the project (which will be automatically synced to all Collectors), then start building your NCover Run command.
Here's a link to a doc that explains the use of the Run command: http://www.ncover.com/support/docs/v4/feature-reference/command-line/ncover-run
Basically, the NCover Run command:
- Collects data from the covered process (in your case, MSTest)
- Sends the coverage results to the project you specify (the one you created above)
The first part of the NCover Run command is the NCover project and (optional) build ID, the second half is the covered application. Use the same syntax in the second part of the Run command that you would use to run MSTest from the command line.
So, a very basic NCover Run command will look something like this:
ncover run --project="MyMSTestProject" -- "mstest.exe" "/testcontainer: UnitTest.dll"
Try NCover Run from the command line, which will make it easier to troubleshoot than running it from a build script.
When the Run command completes successfully, coverage will be collected on MSTest and displayed for your project in the NCover GUI.
Once NCover Run is working as expected from the command line, add it to your build script as an < exec > and test again.