Why PartCover report shows 0% when mstest runs successfully and all tests pass

倾然丶 夕夏残阳落幕 提交于 2019-12-12 10:54:17

问题


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:


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



回答2:


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



来源:https://stackoverflow.com/questions/1033012/why-partcover-report-shows-0-when-mstest-runs-successfully-and-all-tests-pass

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!