How to integrate dotcover and Jenkis.
Any PDF or Guide?
I was able to run the dot cover through command line and it generate test results. However when I try to run in Jenkins through windows batch command it throws an error as
Command 'cover' doesn't support 2 unnamed arguments Type 'dotCover help' for usage.
Anything missing?
dotCover console runner is a command-line tool distributed free of charge as an archive, as a NuGet Package (Windows, macOS, Linux), or as a . NET global tool.
If you click on the Coverage Report icon, you will see code coverage for each package in your application, and even drill down to see the code coverage (or lack thereof) for an individual class (see Figure 2.31, “Jenkins lets you display code coverage metrics for packages and classes”).
I use dotCover from Jenkins. I have multiple DLL's that need testing, so my job will execute dotcover for each DLL, merge the test snapshots, and generate a HTML report. My Jenkins setup includes "HTML Publisher plugin" and "NUnit plugin"
First grab the command line tools and put it on the Jenkins server:
Run the command line tool in a windows batch command:
I had little luck trying to pass params into the command line, so I used the settings xml from dotCover (contents of dotCoverTRAEngineTest.xml):
<?xml version="1.0" encoding="utf-8"?>
<CoverageParams>
<TargetExecutable>C:\NUnit-2.6.3\bin\nunit-console.exe</TargetExecutable>
<TargetArguments>C:\Jenkins\workspace\TRA.CodeCoverage\TRAEngine\TRAEngineTest\bin\x64\RduDev\TRAEngineTest.dll /xml:C:\Jenkins\workspace\TRA.CodeCoverage\TestReports\dotCoverTRAEngineTestRESULTS.xml</TargetArguments>
<TargetWorkingDir></TargetWorkingDir>
<Output>TRAEngineTestSnapshot.dcvr</Output>
</CoverageParams>
Paths on the Jenkins server are hard coded because I'm lazy. I know it should be a parameter somehow but it's working for now.
Next I merge all the snapshots:
Contents of merge xml:
<?xml version="1.0" encoding="utf-8"?>
<MergeParams>
<Source>TRAUnitTests.dcvr</Source>
<Source>TRAEngineTestSnapshot.dcvr</Source>
<Output>MergedSnapshots.dcvr</Output>
</MergeParams>
Then run the report:
Contents of report.xml:
<?xml version="1.0" encoding="utf-8"?>
<ReportParams>
<Source>MergedSnapshots.dcvr</Source>
<Output>CoverageReport.html</Output>
<ReportType>HTML</ReportType>
</ReportParams>
All the .xml files above reside in a folder named "TestReports", and that's where I output all the results to. Jenkins will look there to publish the HTML report and nunit results:
When it all works right you should get the dotCover report and the nunit results on the job page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With