I'm using OpenCover with Visual Studio2010 professional. It works well with NUnit on a command-line.
OpenCover.Console.exe -register:user -target:"C:\bin\NUnit 2.6\bin\nunit-console.exe" -targetargs:"C:\App\Test\ApplicationTest\bin\Debug\ApplicationTest.dll" -targetdir:"C:\App\bin\Debug" -output:html\result.xml
The result is below.
NUnit-Console version 2.6.0.12051 Copyright (C) 2002-20011 Charlie
Poole. Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two,
Alexei A. Vorontsov. Copyright (C) 2000-2002 Philip Craig. All Rights
Reserved.Runtime Environment - OS Version: Microsoft Windows NT 6.1.7601
Service Pack 1 CLR Version: 4.0.30319.269 ( Net 4.0 )ProcessModel: Default DomainUsage: Single Execution Runtime:
net-4.0 .. Tests run: 2, Errors: 0, Failures: 0, Inconclusive: 0,
Time: 42.14 seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0Committing... Visited Classes 59 of 175 (33.7142857142857) Visited
Methods 268 of 4131 (6.48753328491891) Visited Points 15137 of 71763
(21.0930423755975) Visited Branches 196 of 8025 (2.44236760124611)==== Alternative Results (includes all methods including those without
correspon ding source) ==== Alternative Visited Classes 59 of 207
(28.5024154589372) Alternative Visited Methods 284 of 4371
(6.49736902310684)
However it doesn't work with Microsoft.Moles.
OpenCover.Console.exe -register:user -target:"C:\Program Files\Microsoft Moles\bin\moles.runner.x86.exe" -targetargs:"""C:\App\Test\ApplicationTest\bin\Debug\ApplicationTest.dll"" /r:""C:\bin\NUnit 2.6\bin\nunit-console.exe""" -targetdir:"C:\App\bin\Debug" -output:html\result.xml
This result is below.
Microsoft Moles Runner v0.94.51023.0 --
http://research.microsoft.com/moles -- . NET v4.0.30319 Copyright (c)
Microsoft Corporation 2007-2010. All rights reserved.instrumenting...started
NUnit-Console version 2.6.0.12051
CLR Version: 4.0.30319.269 ( Net 4.0 )ProcessModel: Default DomainUsage: Single Execution Runtime:
net-4.0 .. Tests run: 2, Errors: 0, Failures: 0, Inconclusive: 0,
Time: 28.004 seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0Committing... Visited Classes 0 of 2 (0) Visited Methods 0 of 14 (0)
Visited Points 0 of 45 (0) Visited Branches 0 of 2 (0)==== Alternative Results (includes all methods including those without correspon ding
source) ==== Alternative Visited Classes 0 of 2 (0)
Alternative Visited Methods 0 of 16 (0)
The result of tests are both correct but no coverage is there.
I tried to change the argument of moles, example '/args:"/domain=Multiple"', -oldType etc, but it never works.
Does anyone notice me what I should do? Can OpenCover use moles with Nunit?
set CLRMONITOR_EXTERNAL_PROFILERS={1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}
s135.codeinspot.com/q/2342744 – axt_star