UnitTesting in VS2010: How to ship unit tests and test runner in the executable?

倖福魔咒の 提交于 2019-12-11 10:36:40

问题


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.


回答1:


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?



来源:https://stackoverflow.com/questions/8017995/unittesting-in-vs2010-how-to-ship-unit-tests-and-test-runner-in-the-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!