0

I am working with nunit and dotCover for code coverage, if we run nunit-console.exe we need to provide arguments like :

& $nunit /nothread /noshadow /labels /domain=None /trace=Info /framework=net-4.0 /process=Separate

where $nunit is path to nunit-console.exe but I am running nunit-console.exe with dotcover command line and I am providing following arguments

&$dotcover cover /TargetExecutable=$testRunner /TargetArguments=$test /Output="D:\JetBrains.dotCover.CommandLineTools.2019.3.4\TestReport\$testName.dcvr" 

where testrunner is nunit-console.exe and $test has path to test.dll but tests are not passing while running in Nunit.exe (UI app) they are passing.

is there any way I can pass required arguments to nunit in the dotcover script? so when dotcover covers nunit it will run with specified parameters. I tried some workaround like this but it is not working &$dotcover cover /TargetExecutable=$testRunner /TargetArguments=$test /nothread /noshadow /labels /domain=None /trace=Info /framework=net-4.0 /process=Separate /Output="D:\JetBrains.dotCover.CommandLineTools.2019.3.4\TestReport\$testName.dcvr"

but it is showing this error:

[JetBrains dotCover] Not used command line parameter: 'nothread'
[JetBrains dotCover] Not used command line parameter: 'noshadow'
[JetBrains dotCover] Not used command line parameter: 'labels'
[JetBrains dotCover] Not used command line parameter: 'domain'
NetSurfer
  • 103
  • 1
  • 9

1 Answers1

0

You should just need to quote the arguments for the NUnit Console.

&$dotcover cover /TargetExecutable=$testRunner /TargetArguments="$test /nothread /noshadow /labels /domain=None /trace=Info /framework=net-4.0 /process=Separate" /Output="D:\JetBrains.dotCover.CommandLineTools.2019.3.4\TestReport\$testName.dcvr"

Is there any chance that $test may contain quotes itself, or spaces? In which case, you need to quote it, and make sure that you escape the quotes inside quotes. Depends on exactly what command line you're using I think, but you'll probably want something a bit like this...

&$dotcover cover /TargetExecutable=$testRunner /TargetArguments="\"$test\" /nothread /noshadow /labels /domain=None /trace=Info /framework=net-4.0 /process=Separate" /Output="D:\JetBrains.dotCover.CommandLineTools.2019.3.4\TestReport\$testName.dcvr"
Chris
  • 5,882
  • 2
  • 32
  • 57