10

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?

Alessio
  • 3,404
  • 19
  • 35
  • 48
user3756668
  • 101
  • 1
  • 4
  • I have exactly the same Problem, any progress? – Pinte Dani Dec 14 '15 at 13:36
  • [This](https://www.jetbrains.com/help/dotcover/2016.3/dotCover__Console_Runner_Commands.html) page contains detailed descriptions about the dotcover.exe command: – K.Roland Apr 12 '17 at 09:56

1 Answers1

10

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: dotCoverCommandLineTools

Run the command line tool in a windows batch command:

windows batch command to run tests

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: merge

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: 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: results publish

When it all works right you should get the dotCover report and the nunit results on the job page.

Sean
  • 282
  • 3
  • 11