views:

485

answers:

3

Hello,

I'm trying to get code coverage with mstest tests. I'm using PartCover 2.2.0.36424.

The problem is with real assemblies, I get 0% code coverage (Note: All tests pass).
On demo test for demo source that I created, it worked fine (the report makes sense).

I noticed that in log file:
for demo files, after line "Assembly AAAAAA loaded (MyTestesAssemblyName)", there is line "Class NNNNNN loaded (MyTestesAssemblyName.MyClassname)";
and for the real files ther is no second line (for class) after the line for assembly.

Have any ideas what is different in our assemblies? (Note: they are not signed)

10x.

+1  A: 

Check you have added --include [*]* commandline argument and check tests process is compiled to run on x86 (if x64 OS is used)

Eugene Petrenko
+1  A: 

I was having the same problem. I checked fuslogvw.exe because I know mstest.exe can run your test code inside vstesthost.exe. mstest.exe was only loading my code for reflection, which is why it was showing up as 0% in the PartCover report.

To fix this, I specified the /noisolation parameter to mstest.exe through partcover.exe. However, one thing to note, it appear you have to quote all the parameters you specify to pass through to mstest.exe.

Here is the actual command line I know works:

partcover --target \path\to\MSTest.exe --include [*]* --target-args "/noisolation /testcontainer:myut.dll" --target-work-dir \path\to\workingdir --output C:\tmp\PartCoverResults.xml
Wow! This really worked for me. Many thanks.Here is the documentation for the switch: http://msdn.microsoft.com/en-us/library/ms182489.aspx
ulrichb
A: 

we have tried the above solution ......but mstest is passing and partcover result is not generated.........please help ......it is urgent

raj