OpenCover生成一个空报告 [英] OpenCover generates an empty report
问题描述
我使用 OpenCover 以确定一个简单的C#项目code覆盖。
I am using OpenCover to determine code coverage for a simple C# project.
虽然我可以看到MSTest的运行单元测试(和成功)生成的报告是空的。
Although I can see MSTest running the unit tests (and succeeding) the generated report is empty.
这是我使用的命令:
opencover.console.exe -register -arch:32
-target:"%VSINSTALLDIR%\Common7\IDE\mstest.exe"
-targetargs:"/testcontainer:calculatortest.dll"
-filter:+[calculator.dll]* -output:coverage.xml
输出
Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading calculatortest.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Passed CalculatorTest.StatisticsTest.AddOccurrenceTest
Passed CalculatorTest.StatisticsTest.AvgTest
2/2 test(s) Passed
Summary
-------
Test Run Completed.
Passed 2
---------
Total 2
Results file: e:\Users\erno\Documents\Visual Studio 2010\Projects\CodeStatistics\CalculatorTest\bin\Debug\TestResults\erno_ERNO01 2011-07-01 14_27_06.trx
Test Settings: Default Test Settings
Visited Classes 0 of 0 (NaN)
Visited Methods 0 of 0 (NaN)
Visited Points 0 of 0 (NaN)
生成的报告的内容:
<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<VisitPoints />
</CoverageSession>
环保
在code在Windows 7上运行64位,但在32位Visual Studio命令提示符环境中执行。
Environment
The code is running on Windows 7 64-bits but is executed in a 32-bit Visual Studio command prompt environment.
修改我在单元测试的调试版本的目录中运行命令,我添加了OpenCover目录到环境路径。
EDIT I am running the command in the directory with the debug build of the unit tests and I added the OpenCover directory to the environment path.
我搜索了类似的问题,PartCover(因为OpenCover似乎是一种分支),但是找不到匹配的问题,presented解决任何事情。
I searched for similar problems with PartCover (because OpenCover appears to be a sort of branch) but could not find anything that matched the problem and presented a solution.
修改我还测试了更广泛的过滤器 - 筛选:+ [*] *
但这并没有改变任何方式输出。
EDIT I also tested with a broader filter -filter:+[*]*
but this did not change the output in any way.
修改我还测试了MSTest的 / noisolation
参数<一href="http://stackoverflow.com/questions/1033012/why-partcover-report-shows-0-when-mstest-runs-successfully-and-all-tests-pass">as这里提及。还没有结果。
EDIT I also tested with the MSTest /noisolation
argument as mentioned here. Still no results.
修改我也完全去除过滤器并回落到默认的过滤器进行测试。没有结果。
EDIT I also tested by removing the filter completely and falling back to the default filter. No results.
推荐答案
您应该能够使用-register:用户切换每个用户注册做,即它注册(和注销),而不需要完全管理权限。
You should be able to use the -register:user switch to do per user registration i.e. it registers (and unregisters) without needing full admin rights.
这篇关于OpenCover生成一个空报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!