dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.69k stars 1.06k forks source link

dotnet test dll fails with misleading error if there is no code in net framework test project #16155

Open levdimov opened 3 years ago

levdimov commented 3 years ago

Tested with dotnet sdk 3.1 and 5.0

Steps to reproduce

  1. Create new test project using dotnet new nunit.
  2. Change TargetFramework to net48
  3. Make sure dotnet test .\bin\Debug\net48\Tests.dll executes successfully
  4. Delete UnitTest1.cs (single tests file from template)
  5. dotnet test .\bin\Debug\net48\Tests.dll will fail with following error: Unable to find <...>.\bin\Debug\net48\Tests.deps.json. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk".

dotnet test Tests.csproj will fail with understandable message: No test is available in <...>\bin\Debug\net48\Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

Expected behavior

dotnet test .\bin\Debug\net48\Tests.dll should tell that no test is available as dotnet test Tests.csproj does.

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.