Skip to content

nunit Framework tests do not run with "dotnet test" nor inside VS2019 (Windows) #3867

@FrankRay78

Description

@FrankRay78

Expected: as per the NUnit documentation here, I should be able to run the unit tests from the command line using dotnet test

image

Actual: No tests are ever found

Environment
Dell XPS 15, 32BG ram
Running clrver outputs

Versions installed on the machine:
v2.0.50727
v4.0.30319

.Net 5.0 SDK has been installed manually

Steps to reproduce

  1. Open VS2019 and clone the nunit repo into a clean directory
  2. Open windows PowerShell and navigate to the directory
  3. Run build --target=Test --configuration=Release
  4. NuGet packages restored, all dlls are built, all unit tests pass (for all framework targets)

image

  1. Navigate to the bin\Release\net5.0 directory
  2. Run dotnet test nunit.framework.tests.dll --framework:net5.0

image

  1. Open the solution in VS2019 and set the test target architecture to x64

image

  1. Save all and close VS2019
  2. Repeat steps 3, 5 and 6 above

image

  1. Specify the path to the TestAdapters located here:

image

  1. Run the following command dotnet test nunit.framework.tests.dll /TestAdapterPath:C:\Users\frank\Documents\Professional\Source\nunit-VS2019-2\bin\Release\net5.0 --framework:net5.0

image

  1. Open the solution in VS2019 and upgrade to the latest TestAdapter:

image

  1. Repeat build step 3 above.
  2. Check the output has the updated TestAdapter

image

  1. Run the following command dotnet test nunit.framework.tests.dll /TestAdapterPath:C:\Users\frank\Documents\Professional\Source\nunit-VS2019-2\bin\Release\net5.0 --framework:net5.0

image

nb. I've tried the above steps for the net4.5 build output to the same effect

Commentary
I believe the inability to find / execute the tests using dotnet test may explain why I cannot get unit tests to execute within Visual Studio 2019 (with or without Resharper) on Windows and also JetBrains Rider (on either Windows 10 and Debian Linux) - see attached log output
VS2019 test output log.txt

Related Issues
#3008
#2973

Related Discussions
#3861

Additional Information

I ran the following command from the bin\Release\net5.0 directory, dotnet test nunit.framework.tests.dll --list-tests --framework:net5.0 --diag dotnet_test_log.txt --logger "console;verbosity=detailed"

The following logs were generated:
dotnet_test_log.host.21-06-01_20-09-24_22867_6.txt and dotnet_test_log.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions