So far, we have seen running test via Visual Studio 2010, in this post we are going to see how we can execute a test via command prompt.
The reason for running a coded UI test in command prompt are many, there might be situations where you need to execute test
Where only Test Agent is installed not visual studio
Run specific set of test via another process like batch file or powershell commandlet
Run via another tool
Execution of test via command prompt can be achieved by what is called MSTest.exe, which comes along with Visual Studio 2010 and we don’t have to make any separate installation or download.
Let’s see how we can run the test via command prompt without wasting any further time.
Step 1
Open the command prompt and navigate to your visual studio 2010 installation directory which has MSTest.exe.
I have installed my visual studio 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.0.
The MSTest.exe can be found under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE.Step 2
Now type the following command for MSTest.exe with following switches (Arguments)
As you could see above
MSTest – Is the MSTest.exe which executes the test
/testcontainer: – Usually the test project DLL file which are located in bin folder of project
/test: – Test method which we are going to execute
This will automatically execute the test.
Further settings are listed here
/testsettings: – Settings file of test, which can be Local.settings
We can also run vsmdi file with the help of switch called /testcategory:
For more details visit here http://msdn.microsoft.com/en-us/library/ms182489.aspx
Thats it !!!
Thanks,
Karthik KK