5

Is it possible to run NUnit tests with R#, when these tests are in a .NET Core project? I have been unable to do that. If I select the option to produce outputs, then R# cannot find the NUnit assembly.

3 Answers 3

6

Update: The NUnit team and I have released full .NET Core support, it is a console runner that runs tests at the command line and runs tests within Visual Studio's Test Explorer. See NUnit 3 Tests for .NET Core RC2 and ASP.NET Core RC2 for more info.


Neither R#, nor the NUnit Visual Studio adapter, or even the nunit3-console.exe support .NET Core yet. .NET Core projects currently must be tested using NUnitLite by creating a self-executing test assembly.

The NUnit team is working on a better solution that will hopefully be released in the next few months.

Sign up to request clarification or add additional context in comments.

Comments

6

Update December 2016: ReSharper 2016.3 is now available. The xUnit and NUnit test runners will work on ReSharper >= 2016.3

ReSharper Early Access Program 2016.3 EAP now supports running .NET Core Tests from R# and it's Awesome it even runs the tests for each framework.

https://confluence.jetbrains.com/display/ReSharper/ReSharper+2016.3+EAP

enter image description here

Project.json (change as appropriate for your use case)

  {
  "version": "1.0.0-*",

  "testRunner": "nunit",

  "runtimes": {
    "win7-x64": {},
    "win8-x64": {},
    "win10-x64": {}
  },

  "dependencies": {
    "NUnit": "3.4.1",
    "dotnet-test-nunit": "3.4.0-beta-2"
  },

  "frameworks": {
    "net451": {
    },

    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  }
}

2 Comments

Update - It's worth noting that this is regarding netcore RC2 tooling(project.json). Development for rc4 csproj and visual studio 2017 test runner still appears to be underway and will be in the next release. 2016.3 release notes
Still does not support in 2017.1: ReSharper currently doesn’t support continuous testing for .NET Core unit tests. This will be fixed in the next updates. blog.jetbrains.com/dotnet/2017/04/03/…
3

In vs 2015.3 with Resharper 2017.2, you can create unit test using NUnit for .Net Core 2.

  • Create .Net Core 2 library
  • Modify .csproj, add nuget libraies:

        <ItemGroup>
            <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
            <PackageReference Include="NUnit" Version="3.8.1" />
            <PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
          </ItemGroup>
    

For more details read : Nunit docs: .NET Core and .NET Standard

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.