3

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.

Micha
  • 5,117
  • 8
  • 34
  • 47
Sumeshk
  • 1,980
  • 20
  • 33

1 Answers1

3

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"
Micha
  • 5,117
  • 8
  • 34
  • 47
  • 1
    Ok ... we come closer. Can you show the code in the batch-file? – Micha Aug 12 '13 at 09:11
  • 1
    When you start the batch 'by hand' all works fine and if Jenkins (service) do it you receive the error, right? All on same machine? Are the folder privileges so that Jenkins has read-write-access? – Micha Aug 12 '13 at 09:33
  • While executing the batch file in command prompt my test.exe is executed,yes on same machine, i need to create the coverage html, could you please provide code/link. Jenkins installed localy – Sumeshk Aug 12 '13 at 09:44
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/35263/discussion-between-sumeshk-and-micha) – Sumeshk Aug 12 '13 at 09:49