Running NUnit tests in an ASP.NET 5 project (in VS Test Explorer)

I am developing an ASP.NET 5 application for targeting dnx451.

Unlike a regular class library project, test classes are not detected by VS2015 Test Explorer after assembly.

I tried both with the NUnit Test Adapter VS Extension (2.0.0.0) and with the addition of the NUnitTestAdapter NuGet package to the test project.

Am I missing something or is this a common problem with the DNX execution model?

+4
source share
2 answers

Do you have an equivalent command for nunit in the project.json file?

 "commands": {
     "test": "xunit.runner.dnx"
 },

and you restored your decision?

0
source

NUnitLite NUnit ASP.NET Core. , https://github.com/nunit/docs/wiki/NUnitLite-Runner.

  • .
  • Main :

    using NUnitLite;
    
    public class Program
    {
        public int Main(string[] args)
        {
            return new AutoRun().Execute(args);
        }
    }
    
  • (.. ). project.json, , Test , , [Category("SlowTest")].

    {
        "version": "1.0.0-*",
        "description": "Tests for the SelfServicePortal",
    
        "dependencies": {
            "SelfServicePortal": "1.0.0-*",
            "NSubstitute": "1.9.2",
            "NUnit.Runners": "3.0.1",
            "NUnitLite": "3.0.1",
            "NUnit.Console": "3.0.1",
            "Microsoft.Dnx.Runtime": "1.0.0-rc1-final"
        },
    
        "commands": {
            "Test": "SelfServicePortal.Tests -where \"cat != SlowTest\""
        },
    
        "frameworks": {
            "dnx451": { }
        }
    }
    

, . :

Unnecessary censorship test run example

0

Source: https://habr.com/ru/post/1609893/


All Articles