question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newly created Unit Test Projects cannot be run with the Test Execution Command Line Tool

See original GitHub issue

Description

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

  1. Build the solution (default configuration is Debug)
  2. cd into the build folder of the ProjectWithNugetPackages (ie. ProjectWithNugetPackages/bin/Debug)
  3. 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.

  1. Build the solution (default configuration is Debug)
  2. cd into the build folder of the ProjectWithLegacyReference (ie. ProjectWithLegacyReference/bin/Debug)
  3. 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:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ShreyasRmsftcommented, Jun 13, 2018

@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.

0reactions
vagisha-nidhicommented, Nov 2, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't create a Swift command line tool with a unit test target
So far the only solution I've found for this problem is to manually add all the files containing code that you want to...
Read more >
dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >
Run unit tests with Test Explorer - Visual Studio (Windows)
Start testing your C# apps by using the testing tools in Visual Studio. Learn to write tests, use Test Explorer, create test suites,...
Read more >
Visual Studio 2017 Unit testing .NET Core fails to run tests
I created a new unit test project as the only project in my solution. ... the tool there is Microsoft (R) Test Execution...
Read more >
Problems with .NET unit testing
I tried creating a Fresh Unit Test project Using dotnet new xunit and wrote a ... I have some Nunit test assemblies that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found