_From @MiaomiaoHuangfu on October 20, 2017 15:8_
mstest.exe /testcontainer:UnitTestProject1.dll run pass;
No tests to execute.
Test on build 27019.00
`dotnet --info` output:
.NET Command Line Tools (2.1.1-preview-007094)
Product Information:
Version: 2.1.1-preview-007094
Commit SHA-1 hash: f657648f07
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.1-preview-007094\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
_Copied from original issue: dotnet/cli#7873_
May I assume the tests are targeting .NET Core?
We do not intend to enhance mstest.exe to be able to run tests targeting .NET Core.
Please consider using "dotnet test" or vstest.console.exe instead.
Also this is not supported if this is an MSTest V2 test project, Please use an MSTest project for this:
According to the Unit Test Explorer Manual Scenarios, the tests are targeting .NET Framework, not .NET Core. @pvlakshm
@v-wanfe : Then its most likely a result of trying this out on an mstest v2 project. My comments above should help test the right scenario.
Feel free to re-open this issue if that isn't the case.
I realize this is closed, but what is the 'supported' CLI Integration for a MSTest v2 Project? I'm feeling misled to call it a MSTest project if MStest doesn't work 'out of the box' as it were. Changing it to a MSTest v1 project doesn't feel like 'moving foward'.
I have this problem too. How to test MSTest v2 project via command line?
@hrumhurum : Consider using "dotnet test" or vstest.console.exe to run MSTestV2 tests from CLI.
Also this is not supported if this is an MSTest V2 test project, Please use an MSTest project for this:
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 fixed my issue. I am using Jenkins to automate Selenium tests and was running into the "No tests found to execute" issue when Jenkins was using CMD to run the visual studio project dll file. Now it runs fine, thanks!
Most helpful comment
@hrumhurum : Consider using "dotnet test" or vstest.console.exe to run MSTestV2 tests from CLI.