Allow dotnet test to run on all test projects in a given directory
See original GitHub issueFor 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:
- Created 7 years ago
- Reactions:57
- Comments:10 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.Is there even a reason for the
--all
flag? I can be in the solution folder and do a simpledotnet restore
and all projects restore, based on looking for project.json files in the subfolders. I would lovedotnet 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"
.