Using OpenCover and xUnit for .Net on Jenkins

146 views
Skip to first unread message

Paul Simpson

unread,
Dec 1, 2016, 1:50:42 AM12/1/16
to Jenkins Users

Hi,


Not sure if this is the correct forum, but I'm having difficulty getting CodeCoverage reports when running my Unit tests on my C# projects.


I have a Jenkins server set up, which is building my project with MSBuild, running both StyleCop and fxCop against it and reporting it all nicely. I have also installed xUnit and got that to work. I am now trying to add OpenCover to the mix and I can't figure out where I'm going wrong, or how to fix it!


The command line I'm running boils down to:


"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe" -register:path64 -target:"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\xunit\xunit.console.exe" "-targetargs: \"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\JenkinsSandbox.Tests\bin\Debug\JenkinsSandbox.Tests.dll\" -xml \"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\xunit-results.xml\" -parallel all" -output:"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\JenkinsSandbox.Tests\bin\Debug\JenkinsSandbox.coberturacoverage" -coverbytest:*.Tests.dll -targetdir:"C:\Program Files (x86)\Jenkins\workspace\JenkinsSandbox\JenkinsSandbox.Tests\bin\Debug"  -hideskipped:Filter 


The Unit tests run, then in the console I see this...


=== TEST EXECUTION SUMMARY ===
   JenkinsSandbox.Tests  Total: 3, Errors: 0, Failed: 0, Skipped: 0, Time: 2.969s
Committing...
An System.IO.DirectoryNotFoundException occured: Could not find a part of the path 'C:\BuildAgent\work\cb37e9acf085d108\src\common\AssemblyExtensions.cs'. 
An System.IO.DirectoryNotFoundException occured: Could not find a part of the path 'C:\BuildAgent\work\cb37e9acf085d108\src\common\DictionaryExtensions.cs'. 

the Exceptions keep going for about 150-200 lines, and the build fails.


Can anyone suggest where I'm going wrong? I've been beating my head against the wall for 2 days on this!


Thanks in advance,


Paul

Reply all
Reply to author
Forward
0 new messages