Reputation: 68037
Using Visual Studio 2012 (Ultimate) and NUnit 2.6.2, how can I analyze coverage when running NUnit (nunit-console) on the command line? It seems that Visual Studio is able to analyze coverage when NUnit runs tests within Visual Studio, but I need to know how to do this on the command line as well.
Upvotes: 2
Views: 5027
Reputation: 68037
I found out how to do this. Turns out there's this commandline utility vstest.console.exe that's also able to run 3rdparty unit tests, if it has the right adapter(s). Since I've installed the NUnit Test Adapter as an extension to Visual Studio, I must use the /UseVsixExtensions
option to vstest.console.exe. Additonally, to enable code coverage analysis I supply the /EnableCodeCoverage
option.
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /UseVsixExtensions:true /EnableCodeCoverage "C:\Users\Arve\Documents\Visual Studio 2012\Projects\MyApp\MyApp.Tests\bin\Debug\MyApp.Tests.dll"
The above command produces a a file with the suffix .coverage beneath the directory 'TestResults'.
Upvotes: 7