问题
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