Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet test doesn't recursively search folders for .csproj with wildcards

I want to run all tests in several dotnet core C# test projects.

From the root folder if I run 'dotnet test /*.test.csproj' it will only run the tests one folder down. From the root folder if I run 'dotnet test **//*.test.csproj' it will only run the tests two folders down.

How can I get 'dotnet test' to recursively check all folders for a *.test.csproj project? i.e. run test from both projects above.

like image 761
big_tommy_7bb Avatar asked Oct 17 '25 03:10

big_tommy_7bb


1 Answers

Run dotnet test without any argument in the root folder. Make sure you added a .sln file that defines the path for all the projects of your solution, including the test projects. It works for my GitHub repository for an API with test files in folders:

  • Api.IntegrationTests\

  • Logic.Tests\

  • Subfolder\Another.Tests\

I added the third test project just on my local computer (you will not see it on the GitHub repository) to make sure it works:

Test run for ...\Subfolder\Another.Tests\bin\Debug\netcoreapp3.0\Another.Tests.dll(.NETCoreApp,Version=v3.0)

Test run for ...\Logic.Tests\bin\Debug\netcoreapp3.0\Logic.Tests.dll(.NETCoreApp,Version=v3.0)

Test run for ...\Api.IntegrationTests\bin\Debug\netcoreapp3.0\Api.IntegrationTests.dll(.NETCoreApp,Version=v3.0)

like image 195
Guillaume S. Avatar answered Oct 19 '25 10:10

Guillaume S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!