No tests to execute msTest

廉价感情. 提交于 2019-12-08 15:09:10

问题


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?


回答1:


Try this:

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

Ie without the " " around your path to the dll




回答2:


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




回答3:


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

Live and learn I guess




回答4:


I was getting same message "No tests to execute".

What I found out was a silly mistake on my part - in command line, I was using MVCProj09292016.dll(my project DLL) for testcontainer:/ instead of using MVCProj09292016.Tests.dll(my test project assembly).

Bottom line is that check whether you are using correct dl name in command line:it should be your MStest project assembly, in my case it is MVCProj09292016.Tests.dll




回答5:


I had the same issue when I was using XUnit. The problem was that I didn't had included xunit.runner for the project. It's not very obvious, since it only adds a reference to packages.config and csproj-file. It's not visible in Visual Studio references list. It is still obvious in a way that without a runner, how does the mstest know how to run xunit tests.



来源:https://stackoverflow.com/questions/36770501/no-tests-to-execute-mstest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!