使用Opencover生成代码覆盖率文件。使用的命令:
C:\Users\xyz\.nuget\packages\opencover\4.7.922\tools>OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" -targetargs:"/noisolation /testcontainer:\"E:\ABc\XYZService\src\UnitTestProject\tests\bin\Debug\UnitTestProject.dll\"" -filter:"+[UnitTestProject*]*" -mergebyhash -output:C:\Opencover\Report.xml
我收到以下错误消息:
The test source file "/noisolation" provided was not found.
Committing...
No results, this could be for a number of reasons. The most common reasons are:
1) missing PDBs for the assemblies that match the filter please review the
output file and refer to the Usage guide (Usage.rtf) about filters.
2) the profiler may not be registered correctly, please refer to the Usage
guide and the -register switch.
我还尝试过使用MSTest.exe运行测试-该程序成功执行了命令,但未运行任何测试。
Loading E:\ABc\XYZService\src\UnitTestProject\tests\bin\Debug\UnitTestProject.dll...
Starting execution...
No tests to execute.