I am using MStest to run a single test case but could not find a correct command
I tried:
1)mstest.exe /testcontainer:testproject.dll /test:MethodTest1 This run all the test case starting from name MethodTest1. I have other test name Like MethodTest100, MethodTest101
2)mstest.exe /testcontainer:testproject.dll /test:MethodTest1 /unique This needs to pass Test Namespace name and Test Class name.
It works when i execute following but i have only access to Test Method not to class or namepsace mstest.exe /testcontainer:testproject.dll /test:TestNamespace.TestClass MethodTest1 /unique
I would appreciate if somebody could help me in exact command to run a single test case without using Class Name or Name pace in which TestMethod Lies.
Thanks
Use the command MSTest from the command prompt. The MSTest command expects the name of the test as parameter to run the test. Just type MSTest /help or MSTest /? at the Visual Studio command prompt to get help and find out more about options.
Select the individual tests that you want to run, open the right-click menu for a selected test and then choose Run Selected Tests (or press Ctrl + R, T). If individual tests have no dependencies that prevent them from being run in any order, turn on parallel test execution in the settings menu of the toolbar.
run Visual Studio unit tests by using MSTest.exe, located at %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe in my case. using /testcontainer:Path\To\Your\TestProjectAssembly. dll to indicate where your tests are coded. You can specify multiple '/testcontainer' options if required.
For running multiple tests under a given class or namespace, you can use a wild card *.
So, running:
mstest.exe /testcontainer:testproject.dll /test:TestNamespace.TestClass.*
will work
A test case name only needs to be unique within the context of a test class, and a test class name only needs to be unique in the context of a test namespace. Therefore, when you want to run a single test (by name) you always have to also supply the names of the containing namespace and class. Otherwise, MSTest is not able to uniquely identify the test you want to have run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With