Please visit NCover Report for updated information.
Reporting is critical to sharing code quality statistics with a team and with project stakeholders. Reporting on code coverage is also of huge benefit on continuous integration servers, where there would otherwise be no feedback from running NCover during the testing process. Reports can be generated with NCover either on the command line with the NCover Reporting Command Line tool, or through the reports tool in NCover Explorer. In this article we'll walk you through creating reports with both tools, and give an overview of the reports available through NCover.
Generating Reports With NCover Explorer
The easiest way to generate a report with NCover is through NCover Explorer. Make sure that you have an NCover coverage file open, and if you want trend graphs in your report, that you have a trends file loaded as well. Then, choose "Generate Reports" from the toolbar.
In the Generate Reports Dialog you can choose from over 20 different reports. Choose the report that you would like to run, the output format (HTML or XML), where you want the report saved, and click "Generate Report". NCover Explorer will open the generated report in your browser if "the Display after generation" option is checked.
Generating Reports With The NCover Reporting Command Line Tool
When generating reports as part of an automated build or from a script, you'll want to use the NCover.Reporting.exe command line tool. You can learn more about the command line options that are available in the tool in the reference documentation, or by running it with the //? option. There are many options available, but for now we'll look at the most frequent use cases.
To generate a report you'll need a coverage file. You can generate a full html report with the following command line:
NCover.Reporting Coverage.xml //or FullCoverageReport:Html //op "C:\Coverage Report"
This command line will generate a full coverage report based on the Coverage.xml coverage file in the directory C:\Coverage Report.
To include a graph of trends with your report, you'll need a trends file. To generate a full html report with trends, use the //lt command line flag.
NCover.Reporting Coverage.xml //lt coverage.trend //or FullCoverageReport:Html //op "C:\Coverage Report"
Command lines for the NCover Reporting Command Line Tool can become fairly complicated. Fortunately, your settings for the NCover.Reporting Command Line Tool can be stored to an XML file so that the same options can be used for subsequent runs. You can learn more about the NCover.Reporting Config File format here.
Should I Generate HTML or XML?
Several build servers require that you display reports in their interface by processing XML files with XSLT. For that reason, many of NCover's reports are available in both HTML and XML formats. For most scenarios, though, you'll want to generate HTML reports.
Available Report Types
A complete list of all the reports available in NCover is available here.