如何配置 MSTest 设置以禁用代码覆盖率的强名称签名
我想在单元测试中运行代码覆盖率。
问题是我用多个文件签名。 MSDN 表明这需要多个测试配置(因为代码覆盖率配置仅允许选择单个 .snk 文件)
我可以在测试配置文件中配置代码覆盖率以仅在单元测试期间禁用签名,以便我可以保留单个测试吗?我已阅读有关将 -vr 添加到 sn 的 MSDN 文档,如
http://msdn.microsoft.com/en- us/library/ms243141(v=vs.80).aspx
但我不知道如何在我的测试配置中执行此操作。
有什么建议吗?
I want to run code coverage in my unit tests.
The issue is that I sign with multiple files. MSDN indicates that this requires multiple test configurations (because code coverage config only allows selecting a single .snk file)
Can I configure the code coverage in my test config file to disable signing just during the unit testing so that I can keep a single test? I have read MSDN docs on adding the -vr to the sn as in
http://msdn.microsoft.com/en-us/library/ms243141(v=vs.80).aspx
But I don't see how I can do this in my test config.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 SN -vr 选项是
因此,实际上,您只需在测试阶段不需要重新签名程序集,并且在执行测试之前,您可以在测试的计算机系统上禁用程序集签名验证将使用 SN -vr 选项运行。
要在测试序列中执行此操作,您可以使用 测试配置文件中的设置和清理脚本页面。使用安装脚本行调用批处理脚本,该脚本将禁用测试系统上涉及的程序集的程序集签名验证。使用清理脚本行调用批处理脚本,该脚本将再次启用程序集签名验证。
那应该可以正常工作...
The intention of using the SN -vr option is to
So actually, you just do not re-sign your assemblies for the testing phase, and before you execute the tests you disable assembly signing verification on the computer system that your test will be running on using the SN -vr option.
To do this in your testing sequence you can use the Setup and Cleanup Scripts page in your test configuration file. Use the Setup script line to invoke a batch script that will disable assembly signing verification for the involved assemblies on your test system. Use the Cleanup script line to invoke a batch script that will enable assembly signing verification again.
That should work fine ...