OpenCover Isn't Passing Arguments to NUnit
質問
I just grabbed NUnit, NUnit Runners, and OpenCover from Nuget. The NUnit parts are running great, both in GUI and console mode. But in PowerShell I can't seem to get OpenCover to work properly. Following various examples of usage, I ended up with this command:
.\OpenCover.Console.exe -register:user -target:"..\NUnit.Runners.2.6.1\tools\nunit-console.exe" -targetargs:"/noshadow C:\Path\To\Tests.dll" -filter:+[*]* -output:coverage.xml
I see the opening copyright info from NUnit, but then NUnit tells me:
fatal error: no inputs specified
Followed, of course, by standard help output describing the flags and whatnot. Then, naturally, OpenCover also displays an error indicating that nothing matched the filter and there are no results.
So I tried running NUnit directly:
..\NUnit.Runners.2.6.1\tools\nunit-console.exe /noshadow C:\Path\To\Tests.dll
And it runs fine. Tests pass, everything's happy. Thinking that maybe the documentation and examples are outdated, I tried combining the targetargs
directly into the invocation:
.\OpenCover.Console.exe -register:user -target:"..\NUnit.Runners.2.6.1\tools\nunit-console.exe /noshadow C:\Path\To\Tests.dll" -filter:+[*]* -output:coverage.xml
But the error output is still the same.
Am I missing something in the proper usage of OpenCover? How can I get it to properly interact with the NUnit console runner?
解決
Could it be to do with setting the current working directory first?
I also have my filter argument in quotes, e.g. -filter:"+[*]*"
Might be worth ruling these out at least...