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.

Allow dotnet test to run on all test projects in a given directory

See original GitHub issue

For continuous integration, I want to be able to run dotnet test on all test projects in the test directory of my solution, without having to explicitly configure each subdirectory manually, by e.g. issuing

dotnet test --all

or

dotnet test --all-from test

from the solution directory.

Steps to reproduce

In the solution directory, run

dotnet test

Expected behavior

Runs all tests in test subdirectory.

Actual behavior

dotnet-test Error: 0 : System.InvalidOperationException: C:\solution-dir\project.json does not exist.
   at Microsoft.DotNet.Tools.Test.TestCommand.GetProjectPath(String projectPath)
   at Microsoft.DotNet.Tools.Test.TestCommand.DoRun(String[] args)

Environment data

.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:57
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

26reactions
dazinatorcommented, Jul 5, 2016

There could be some evaluation of the project.json file to ensure it is a valid test project, such as ensuring there is a testRunner property, such as “testRunner”: “xunit”.

Yes please! Just setting up a CI build, and having to CD into each test project directory to run dotnet test is a maintainance headache, as I keep having to revisit this build script as new test projects are added.

19reactions
bojingocommented, Jun 30, 2016

Is there even a reason for the --all flag? I can be in the solution folder and do a simple dotnet restore and all projects restore, based on looking for project.json files in the subfolders. I would love dotnet test to work this same way. I have a number of test projects and my VSTS build definition is littered with tasks for running tests.

There could be some evaluation of the project.json file to ensure it is a valid test project, such as ensuring there is a testRunner property, such as "testRunner": "xunit".

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >
net core - Test multiple projects with dotnet test using pattern
That way, it will run all the tests from all the projects added to the ... for test projects in the current directory...
Read more >
Dotnet Core - Filter out specific test projects when running ...
Quick example showing how to exclude tests in a certain project when running dotnet test.
Read more >
Running Unit Tests With Dotnet Test - NET Core Tutorials
With .net core comes a new way to build and run unit tests with a command line ... Open a command prompt inside...
Read more >
Testing .NET Core Apps with Visual Studio Code
The simplest way to run a test in a .NET Core app is from the command line. The dotnet test command will find...
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