Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xUnit Test Runner failed to run tests through ReSharper

  • Visual Studio 2015 Enterprise Update 3, all KB package updates are applied
  • ReSharper 2016.1.2, latest
  • According to my project.json file xunit references are;
    • "xunit": "2.2.0-beta2-build3300", "xunit.abstractions": "2.0.1-rc2", "xunit.assert": "2.2.0-beta2-build3300", "xunit.extensibility.core": "2.2.0-beta2-build3300", "xunit.extensibility.execution": "2.2.0-beta2-build3300", "xunit.runner.console": "2.2.0-beta2-build3300", "xunit.runner.visualstudio": "2.2.0-beta2-build1149", "xunit.runners": "2.0.0"
  • .Net framework is 4.5.2
  • .Net Core Solution type which means .xproj

When i try to use ReSharper xUnit test runner, i'm encountering;

"Unit Test Runner failed to run tests, Unable to run xUnit tests - File not found:"D:\srcs\GitProjects..etc\bin\My.Tests.dll" Parameter name: assemblyFileName

enter image description here Sorry for Turkish exception details, i couldn't change yet. Any idea about that? I searched a lot of forums and i couldn't find any useful stuff. Thanks in advance.

like image 494
Oğuzhan Soykan Avatar asked Aug 02 '16 21:08

Oğuzhan Soykan


People also ask

How do I run a test using ReSharper?

Ctrl+U R / Debug Unit Tests. Ctrl+U D on the toolbar. To run all tests in the session, click Run Current Session. Ctrl+U Y on the toolbar or alternatively, choose ReSharper | Unit Tests | Run Current Session from the main menu.

Is xUnit a test runner?

The MSBuild runner in xUnit.net v2 is capable of running unit tests from both xUnit.net v1 and v2. It can run multiple assemblies at the same time, and build file options can be used to configuration the parallelism options used when running the tests.

How do I run xUnit tests from command line?

From the command line, create a folder for your test project, change into it, and then create the project using dotnet new : $ mkdir MyFirstUnitTests $ cd MyFirstUnitTests $ dotnet new xunit The template "xUnit Test Project" was created successfully.


2 Answers

Support for .NET Core testing in Resharper is scheduled for 2016.3

The workaround is to use Visual Studio Test Explorer. (Test --> Windows --> Test Explorer)

The project.json file must contain xunit and dotnet-test-xunit:

{
  ...
  "testRunner": "xunit",
  "dependencies": {
    ...
    "xunit": "2.2.0-beta2-build3300",
    "dotnet-test-xunit": "2.2.0-preview2-build1029",
  },
  ...
}

Rebuild your project and you should be able to successfully run your tests. If you have Visual Studio 2015 you can start your test inside the code.

Update: (2017-02-08) It also works with nunit;

{
  "testRunner": "nunit",
  "dependencies": {
    ...
  "NUnit": "3.5.0",  
  "dotnet-test-nunit": "3.4.0-beta-3"
  },
...
}
like image 159
Rubanov Avatar answered Oct 16 '22 09:10

Rubanov


ReSharper doesn't currently support .net core testing. This is scheduled for 2016.3.

like image 26
citizenmatt Avatar answered Oct 16 '22 10:10

citizenmatt