Search code examples
jenkinsnunitopencover

OpenCover not generated Nunit result


In our continuous integration process we are using Jenkins, NUnit and OpenCover.

Every Jenkins job runs NUnit and OpenCover, but OpenCover calls the NUnit batch file in order to determine code coverage; therefore NUnit is executed twice.

For example we have a first (simplified) batch:

nunit-console-x86 [PathToTestAssemblies] /xml=NunitResult.xml /noshadow /nodots /process=Separate

And we have a second batch for OpenCover:

OpenCover.Console.exe -target:"NUnit.bat" -output:"./OpenCoverResults.xml" -register -targetdir:".\bin" -coverbytest:*.dll

The problem is that OpenCover does not provide NUnit result (The NunitResult.xml file in my previous command). So in order to have less test time for every Jenkins job we want to get back the NUnit result or find a way to have the following features with OpenCover in the Jenkins job web page:

  • Latest Tests result from every Jenkins job, so it is easy for a developer to see the latest result.
  • Test result trend

Is there a way to have both NunitResult and OpenCover results from an single run of NUnit?


Solution

  • I finally found were was the NUnitResult.xml file. In fact it was in the folder were I put all test assemblies (ex: bin) while the Nunit batch put it at the root location.

    I think this is because I use the -targetdir args with "bin" to indicate OpenCover were are my assemblies.