Newly created Unit Test Projects cannot be run with the Test Execution Command Line Tool
See original GitHub issueDescription
Tests inside unit test projects that target .Net Framework 4.5 and do not reference Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
are not runnable with the Microsoft Test Execution Command Line Tool.
Note: I’m not sure if this is the right repo to report this in, but can’t find anything better.
A complete working example can be found at https://github.com/Zymus/mstest-bug
Steps to reproduce
- Build the solution (default configuration is Debug)
cd
into the build folder of the ProjectWithNugetPackages (ie.ProjectWithNugetPackages/bin/Debug
)- Run mstest with the test container as the built dll (
mstest.exe /testcontainer:ProjectWithNugetPackages.dll
)
Expected behavior
My current expectation is that, if someone creates a Unit Test Project through Visual Studio, then that project is immediately runnable through the Microsoft Test Execution Command Line Tool. However, that doesn’t seem to be the case.
- Build the solution (default configuration is Debug)
cd
into the build folder of the ProjectWithLegacyReference (ie.ProjectWithLegacyReference/bin/Debug
)- Run mstest with the test container as the built dll (
mstest.exe /testcontainer:ProjectWithLegacyReference.dll
)
Output should look something like:
Microsoft (R) Test Execution Command Line Tool Version 15.0.27019.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading ProjectWithLegacyReference.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Passed ProjectWithLegacyReference.UnitTest1.TestMethod1
1/1 test(s) Passed
Summary
-------
Test Run Completed.
Passed 1
---------
Total 1
Actual behavior
Output of running mstest against the ProjectWithNugetPackages looks like
Microsoft (R) Test Execution Command Line Tool Version 15.0.27019.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading ProjectWithNugetPackages.dll...
Starting execution...
No tests to execute.
Environment
OS: Windows 7 Versions of the Microsoft Test Execution Command Line Tool tested against:
- 14.0.23107.0
- 14.0.25420.1
- 15.0.27019.1
- 15.0.26621.2
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
@Zymus any more queries here? VS2017 should allow you to run MsTestV2 tests with minimal effort. Please move there. If this is not possible please follow the workaround specified by @jayaranigarg. Lemme know if you have any follow up questions, else will close the the issue.
Hi @usamakhalil86 How are you trying to run the tests? The IDE uses vstest.console.exe to run tests. Are you facing any issues while running tests with VS 2017? Can you please provide us logs and screenshots or a repro project so that we can take a look? You can collect logs in ide by enabling Tools->Options->Test->Logging Level->Diagnostic This might help you when collecting logs using command line.