I have a [TestMethod] in a visual studio test project. If I build the project, I get a dll. I dont want to run the tests from the visual studio User Interface.
Is there any way to generate an exe of a test project so that i can run the tests from command prompt?
If I change the project type from Class Library to Console Application, then it requires a Main function. Is there any way to call a TestMethod from the Main()
You can run the unit tests inside Visual studio through the menu: Test -> Run -> ...
Two options: - Tests in current context - All tests
Context could either be project level, class level or method level. Depends on where you put your marker inside the test class or if you have selected a class/file/project in the solution explorer.
You can use the hotkey combination CTRL + R, T to run tests in current context or CTRL + R, A to run all tests.
EDIT: ref comment.
You should already have an EXE that can execute your tests - mstest.exe. If you need to run your tests outside Visual Studio - and you're not using some kind of build automation solution that can already do this for you - then you can call mstest.exe and have it execute your tests.
http://msdn.microsoft.com/en-us/library/ms182489(VS.100).aspx
I think what you want is some sort software for test automation. My company uses Jenkins . Works really well, and you can use it together with source control software as well, to run the tests when someone checks something in.
You may want to utilize TFS - Microsoft Team Foundation Server, a stand-alone server-side application system to build a project and run tests inside it.
Also you can run them inside Visual Studio (menu Tests -> Run -> ...).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.