How to run xUnit 2.1.0-beta-* for DNX projects with ReSharper

638 views Asked by At

How to run xUnit 2.1.0-beta-* for DNX projects with ReSharper?

When the ReSharper do find the tests, it fails on running them with System.IO.FileNotFoundException that indicates the unit test assembly is not found.

Due to my understanding, DNX projects do NOT generate assemblies in \bin folder when they are compiled with VisualStudio 2015. Is there a way to force DNX projects generate assemblies like the tranditional class libraries projects?

Any ideas?

2

There are 2 answers

0
citizenmatt On BEST ANSWER

DNX tests aren't currently supported by ReSharper or the xunit plugin. It's a whole new execution model, and hasn't yet been implemented for ReSharper. I'd expect to see support as DNX and asp.net stabilise and near release.

1
urig On

xUnit now supports DNX. Not sure if this will let you run the tests from ReSharper though.

Here are the instructions, taken from https://github.com/xunit/dnx.xunit :

This runner supports xUnit.net tests for DNX 4.5.1+, and DNX Core 5+ (this includes ASP.NET 5+). Usage

To install this package, ensure your project.json contains the following lines:

{
    "dependencies": {
        "xunit": "2.1.0-*",
        "xunit.runner.dnx": "2.1.0-*"
    },
    "commands": {
        "test": "xunit.runner.dnx"
    }
}

To run tests from the command line, use the following.

# Restore NuGet packages
dnu restore

# Run tests in current directory
dnx test

# Run tests if tests are not in the current directory
dnx -p path/to/project test