VS2010 中的单元测试:如何在可执行文件中发送单元测试和测试运行器? [英] UnitTesting in VS2010: How to ship unit tests and test runner in the executable?

查看:57
本文介绍了VS2010 中的单元测试:如何在可执行文件中发送单元测试和测试运行器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在提供给客户的最终可执行文件中提供单元测试代码和测试运行程序.

<块引用>

通过这种方式,我可以在客户站点运行我的单元测试、功能测试和集成测试,或者帮助解决问题.

并不是说我需要证明我的问题.

解决方案

Microsoft 提出的解决方法 是使用 .Net 4 的 代码契约

到目前为止,我只听说过成功 使用 NUnit 进行单元测试.你能用 NUnit 吗?

i want to ship unit test code, and the test runner, in the final executable that is given to the customer.

i want to do this so that tests can be run at, by, for or with the customer.

The problem is that Visual Studio's test system seems to be contained in the assembly:

c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

and this assembly doesn't ship with the .NET framework (full or client profile).

This would mean that i would not be able to run the tests on a machine that does not have Visual Studio (2010) installed.

What's the next best workaround, given the requirement of a single executable.


It's quite handy in other languages to be able to access unit tests with an advanced keyboard shortcut:

This way i can run my unit tests, my functional tests, and my integration tests at the customer site, or to aid problem solving.

Not that i need to justify my question.

解决方案

The proposed workaround by Microsoft is to use .Net 4's Code Contracts

So far, I have only heard success Shipping unit tests using NUnit. Can you use NUnit?

这篇关于VS2010 中的单元测试:如何在可执行文件中发送单元测试和测试运行器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆