UnitTesting in VS2010: How to ship unit tests and

2019-08-01 10:24发布

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:

enter image description here

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条回答
我命由我不由天
2楼-- · 2019-08-01 11:01

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?

查看更多
登录 后发表回答