Omu
Omu

Reputation: 71268

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 ?

Upvotes: 17

Views: 41673

Answers (3)

Adam V. Steele
Adam V. Steele

Reputation: 639

If Using .Net Core:

dotnet test ./nameoftest.dll

In the folder where the test is located.

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

Upvotes: 6

Amuk Saxena
Amuk Saxena

Reputation: 1571

I got the answer from this thread: https://gist.github.com/leniel/2438148

Just run the following command to run test cases by using MSTest /testcontainer

C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE>MSTest /testcontainer:"C:\project-name\projectTestSolutionFolder\bin\Release\ProjectTest.dll"

Upvotes: 1

Reed Copsey
Reed Copsey

Reputation: 564791

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

Upvotes: 24

Related Questions