Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run MSTests from windows command line

I have 5 solutions all using MSTest and I would like to have a cmd file in a root folder that will run all the tests

so I would like to call the MsTests runner from the command line against

\Solution1\Tests\Debug\Test.dll
...
\Solution5\Tests\Debug\Test.dll

anybody knows how can this be done ?

like image 384
Omu Avatar asked Sep 06 '12 16:09

Omu


People also ask

Where is MSTest EXE located?

Add the folder that contains MSTest.exe to your path variable and restart the execution server. The default path is: C:\Program Files (x86)\Microsoft Visual Studio <version>\Common7\IDE.

How do I run a specific test in Visual Studio?

Tests can be run from Test Explorer by right-clicking in the code editor on a test and selecting Run test or by using the default Test Explorer shortcuts in Visual Studio.


2 Answers

If Using .Net Core:

dotnet test ./nameoftest.dll

In the folder where the test is located.

For command line options see: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test

like image 133
Adam V. Steele Avatar answered Sep 25 '22 05:09

Adam V. Steele


This is detailed on MSDN: How to: Run Automated Tests from the Command Line Using MSTest

Basically, you can do:

MSTest /testcontainer:\Solution1\Tests\Debug\Test.dll
like image 35
Reed Copsey Avatar answered Sep 25 '22 05:09

Reed Copsey