How to correctly specify arguments of a covered application for the console runner

When running coverage using the dotCover console runner, typically you should pass some arguments to the covered application.

Arguments with relative paths

If arguments contain relative paths, the console runner automatically converts them to the absolute ones according to the following rules:

  • Relative paths specified in an XML configuration file are considered relative to the location of this file.
  • Relative paths specified in the command line are considered relative to the current working directory.

For example, you want to cover E:\Tests\Builds\MyTests.dll using NUnit. Your current directory is E:\Tests\Builds\.

E:\Tests\Builds>c:\dotCoverCmd\dotcover.exe analyse /TargetExecutable="C:\Program Files\NUnit 2.6\bin\nunit-console.exe" /TargetArguments="MyTests.dll /xml=..\Coverage\Cover.xml" /Output="CoverageReport.html" /ReportType="HTML"

NUnit will get the following arguments:

E:\Tests\Builds\MyTests.dll /xml=E:\Tests\Coverage\Cover.xml

Arguments with spaces in paths

If arguments contain paths with spaces, you should escape them with additional double quotes and a backslash, e.g.,
... /TargetArguments="\"D:\My Projects\My Application\bin\Debug\AppTests.dll""

Please sign in to leave a comment.

Have more questions?

Submit a request