如何使用:PartCover .NET 4 与 NUnit 2.5.6
假设我有测试程序集(NUnit 兼容)App.Test.dll 和要测试的库 App.dll。
如何使用 PartCover 和 NUint 进行代码覆盖率分析?
Say I have Test assembly (NUnit compliant) App.Test.dll and a library to be tested App.dll.
How do I get the code coverage analysis using PartCover and NUint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我同意。在我的实验中(请参阅此处的博客文章:http:// www.csharpcity.com/using-partcover-and-nunit-for-code-coverage/)我建立了一个带有 NUnit 兼容的“AutomatedTest”项目的项目(它引用了 NUnit 的框架 DLL 并输出了完整的 DLL测试类),并通过 PartCover 运行它。
I concur. In my experiments (see blog post here: http://www.csharpcity.com/using-partcover-and-nunit-for-code-coverage/) I set up a project with an NUnit-complaint "AutomatedTest" project (which referenced NUnit's framework DLL and outputted a DLL full of test classes), and ran that through PartCover.
最简单的方法是设置一个 NUnit 测试项目(运行 App.Test.dll),然后从 PartCover 调用 NUnit 控制台运行程序并将项目名称作为参数传递。如果您想查看的话,我有一篇关于它的博客文章。
(我还没有尝试过 .Net 4 或最新版本的 NUnit/PartCover,但我假设它仍然是相同的)。
The easiest way is to set up an NUnit test project (which runs App.Test.dll), then from PartCover call the NUnit console runner and pass the project name as a parameter. I have a blog post about it if you want to check that out.
(I haven't tried with .Net 4 or the latest versions of NUnit/PartCover but I'm assuming it's still the same).
我花了一段时间才弄清楚如何获取源代码标记。我必须在“工作参数”中放置一个 /noshadow 标志。 /noshadow 阻止 NUnit 制作文件的卷影副本,并允许 PartCover 在浏览器中加载源文件。
然后运行后只需点击“Views->View Coverage Detail”即可。
It took me a while to figure out how get the source code markings. I had to put a /noshadow flag in the "Working Arguments". /noshadow prevents NUnit to make shadow copies of the files and will allow PartCover to load source files in the browser.
Then just click "Views->View Coverage Detail" after the run.