10

I'm running dotCover with NUnit3 to get coverage reports on our build server. We also need the detail output from NUnit to show the test results. Is there any way to get both the NUnit test detail and the files for dotCover without running NUnit twice? Or do I need to run NUnit for the detailed testing then run dotCover with NUnit for coverage reporting?

Richard Schaefer
  • 385
  • 2
  • 12
  • 40

2 Answers2

0

I don't use NUnit and I don't know if it works, but I found something interesting. If you use the latest DotCover's version (2017.1), take a look at this documentation.

In the "Getting started" section you can found :

The command : dotCover analyse config.xml and the config.xml file.

<?xml version="1.0" encoding="utf-8"?>
<AnalyseParams>
  <TargetExecutable>D:\Program Files\NUnit 2.6\bin\nunit-console.exe</TargetExecutable>
  <TargetArguments>D:\Projects\TheApplication\bin\Debug\AppTests.dll</TargetArguments>
  <Output>AppCoverageReport.html</Output>
  <ReportType>html</ReportType>
</AnalyseParams>
<Filters>
  <ExcludeFilters>
    <FilterEntry>
      <ClassMask>IntegrationTests</ClassMask>
    </FilterEntry>
  </ExcludeFilters>
</Filters>

Maybe you can specify your NUnit3 path and it could work?

yanckst
  • 341
  • 2
  • 15
  • This gives you the coverage results, not the unit testing detail. Hence my quandary. I'm running NUnit separately to get UT results in XML but I have no way that I can find to translate the XML to HTML that works reliably and has been updated in the last few years. – Richard Schaefer Aug 18 '17 at 10:21
0

The /TargetArguments or <TargetArguments> needs to include the command line arguments that NUnit3 uses (not "/xml=" as in NUnit2, but something else).
For NUnit2 /TargetArguments="AppTests.dll /xml=D:\CCNET\Logs\Projects\AppTestsResult.xml"

So full command for NUnit2 is:
D:\DotCover\dotcover.exe cover /TargetWorkingDir="D:\Projects" /TargetExecutable="packages\NUnit.Runners.2.6.4\tools\nunit-console-x86.exe" /TargetArguments="TheApplication\bin\Debug\AppTests.dll /xml D:\CCNET\Logs\Projects\AppTestsResults.xml /framework:net-4.0 /noshadow /exclude:Manual /work=D:\CCNET\Temp" /Output=D:\CCNET\Logs\Projects\AppTests.dcvr /LogFile=D:\CCNET\Logs\Projects\DotCoverAppTests.log /TempDir=D:\CCNET\Temp

Getting quotes in <TargetArguments> may require use of &quot;

Michael
  • 86
  • 4