'Running unit tests from a command line

I'm working on a suite of application that interact with many websites and api's. I have created unit tests that test this code.

As it's beyond my control, I want to know as soon as sites / api's change and the code stops working so I can fix and would like to run the tests periodically against the assemblies running. How can I run the tests outside of VS?

I'd like the option of testing on Linux mono too.



Solution 1:[1]

You can use MsTest from the command line:

Example:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest" /testcontainer:C:\MyTestProject\bin\debug\MyTestProject.dll /resultsfile:C:\TestResults\results.trx

(Full list of command line switches on the link above)

This is set to Visual Studio 2015, for 2017 just make sure you have the right version number, I believe 15.0

Solution 2:[2]

MSTest has been deprecated, you'll want to invoke VSTest from the command line

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NikolaiDante
Solution 2 aydjay