How to run xUnit 2.1.0-beta-* for DNX projects wit

2019-07-21 05:03发布

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条回答
太酷不给撩
2楼-- · 2019-07-21 05:13

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
查看更多
Viruses.
3楼-- · 2019-07-21 05:30

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.

查看更多
登录 后发表回答