Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No tests to execute msTest

I'm trying to run .NET unit tests on the command line using MSTest

My command is

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:"full path of dll" /resultsfile:TestResults.trx

When run it returns

Starting execution...
No tests to execute.

The unit test runs perfectly fine in VS 2012 IDE.

What do I need to do to get it running on the cmd line please?

like image 601
mogoli Avatar asked Apr 21 '16 13:04

mogoli


3 Answers

In my case I started getting "No tests to execute" on command line when I switched to .NET Framework 4.6.1. I had to switch from MSTest.exe to VSTest.Console.exe for it to work.

Some instructions on how to use vstest.console.exe are here - https://msdn.microsoft.com/en-us/library/jj155800.aspx

Also check this out - https://msdn.microsoft.com/en-us/library/ms182486.aspx

like image 50
Ppp Avatar answered Nov 10 '22 20:11

Ppp


It turns out I needed to use the nunit-console as my tests are written in the nunit framework.

Live and learn I guess

like image 43
mogoli Avatar answered Nov 10 '22 20:11

mogoli


  1. Create a .Net Framework unit test project.

  2. Manage nuget packages -> Remove "MSTest.TestFramework" and "MSTest.TestAdapter" nuget packages.

  3. Add an assembly reference to "Microsoft.VisualStudio.QualityTools.UnitTestFramework", 10.0.0.0.

  4. Rebuild the project and verify that the output path(bin\debug) does not have any _MSTest_TestAdapter*.dll assemblies This works for me.

like image 4
doublnt Avatar answered Nov 10 '22 20:11

doublnt