NCover Documentation

A Batch of Awesomeness

Interested in running coverage asynchronously on multiple services and / or applications at the same time...all from the comfort of your command line? We went to the drawing board and created a handy batch script to guide you in implementing the fastest coverage you've ever experienced. In this example, we are running a console application, a service, and IIS coverage simultaneously and merging the results afterwards. Why do this? Because we can. And it's cool.


@Echo Off

rem A SCRIPT TO SPAWN MULTIPLE PROCESSES AND VIEW THEIR EXECUTION IN THE EXISTING WINDOW USING /b

set Coverage_Path="C:\Users\david\Desktop\coverage"

rem set the working dir to the coverage file dir so the reporting command below 
rem will gather all data from this run and merge it. 
cd %Coverage_Path%

rem Use environment variables to auto-create folders per testing session.  All files in that folder will be merged.
call:setPath
start /b ncover.console //svc service.exe //x %Ncover_data%
call:setPath 
start /b ncover.console application.exe //x %Ncover_data%
call:setPath 
start /b ncover.console //iis //x %Ncover_data%

rem set the directory above so file names can be relative
ncover.reporting *.nccov //s merged_coverage\merged.nccov //at myTrendyFile.trend 

rem a function to set the file path to a random number
GOTO:EOF
:setPath
set Ncover_Data=%Coverage_Path%\%random%-%random%-%random%.nccov
GOTO:EOF

If you still need technical assistance, we can help:

Submit A Support Ticket