How to calculate code coverage with NCover using Jenkins?

c#, code-coverage, jenkins, jenkins-plugins, ncover

Solution

You can use the NCover plug-in or a post-build-task to start the calculation.

For second variant we mostly use a simple batch-file to start the action (in your case the ncover calculation). This batch-file will be called by the jenkins post-build-task.

Edit:

To get HTML you can do it via (look here):

NCover.Reporting Coverage.xml //or FullCoverageReport:Html //op "C:\Coverage Report"

Problem

I am working with a windows application in c#. Using Jenkins, i created a job that will do the following tasks. 1.Build the application using msbuild 2.Tests Unit Test Cases using nunit-console.exe 3.Calculate Code coverage using NCover. (Issue) 4.Later publish the application using Nant plugin Tasks 1, 2 and 4 works fine, while 3 having issue. Can somebody put light on this matter? This is the batch file that i used to find out the coverage ``` C:\Program Files\NCover\NCover.Console.exe" "E:\Myapp\test.exe" -h //x "E:\Newfolder\coverage.xml ``` The batch file is executed in Jenkins and we can see the Test.exe in task manager, what i need is the code coverage in html format when executing the Nunit test cases and no need to run my text.exe ``` D:\Set Up\Nuint\NUnit-2.6.2\bin\nunit-console.exe" "E:\Myapp\test.sln" /xml="E:\Newfolder\TestResult.xml ``` This is the batch command that i used to test the test cases, i need to know the code coverage while executing the test case, but in my case my test.exe is executed and NCover console.exe start monitor my test.exe for calculating the coverage i tried by adding `C:\Program Files\NCover\NCover.Console.exe" infront of "D:\Set Up\Nuint\NUnit-2.6.2\bin\nunit-console.exe" "E:\Myapp\test.sln" /xml="E:\Newfolder\TestResult.xml , build succeded.` and in console o/p found some coverage data like Execution Time: 92.4688 s Symbol Coverage: 43.72% Branch Coverage: 22.70% and a coverage.nccov file is created . but i need to create/show a coverage report in html format.

Original source