How to integrate dotcover and Jenkins
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>
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.