简体   繁体   中英

NUnit marking inconclusive results as “Test Not Run”

I have a unit test with Assert.Inconclusive but the test result in the VS test explorer is "Test Not Run" instead of "Inconclusive". Assert.Fail and Assert.Pass both return the correct test result. What am I doing wrong?

Visual Studio 2015, class library project with NUnit 3. Thanks!

[TestFixture]
public class Class1
{
    [Test]
    public void scratch()
    {
        Assert.Inconclusive();
    }
}

packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="NUnit" version="3.6.0" targetFramework="net452" />
  <package id="NUnit.Console" version="3.6.0" targetFramework="net452" />
  <package id="NUnit.ConsoleRunner" version="3.6.0" targetFramework="net452" />
  <package id="NUnit.Extension.NUnitProjectLoader" version="3.5.0" targetFramework="net452" />
  <package id="NUnit.Extension.NUnitV2Driver" version="3.6.0" targetFramework="net452" />
  <package id="NUnit.Extension.NUnitV2ResultWriter" version="3.5.0" targetFramework="net452" />
  <package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net452" />
  <package id="NUnit.Extension.VSProjectLoader" version="3.5.0" targetFramework="net452" />
</packages>

The NUnit 3 VS Adapter is exactly that... an adapter. It does it's best to adapt NUnit's concepts of tests and test outcomes to the concepts that are understood by Visual Studio and its Test Explorer.

The NUnit notion of an Inconclusive result doesn't exist in Visual Studio, so it has to be reported as something else. Not Run seems to be as close as we can get.

Another discrepancy you will notice is that the new NUnit outcome of Warning is reported by Visual Studio as Skipped. That's an even worse fit, but we use it so that Visual Studio will display the result with the same warning icon it uses for Ignored tests.

As it stands, I don't think we can get a better translation, although suggestions are welcome. Now that Microsoft has open-sourced their test platform ( https://github.com/Microsoft/vstest ) maybe someone will give them a PR that extends the values supported for test outcomes.

I know this is old but whenever I get those kind of results it's almost always one of two things:

  • Possible error in configuration, like a something missing in the app.config
  • Incorrect TestCase arguments, eg Test accepts 2 arguments and I've only passed one

That's my experience anyway

I had same problem.

In my case I had UnitTests project with MSTests. I decided to change MSTests to NUnit. I installed NUnit, altered tests and ran them. All run tests displayed with Inconclusive as result. So I installed NUnit3TestAdapter and tests were run successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM