简体   繁体   中英

Blank output for an ASP.NET NUnit test application

I am currently working with NUnit to write test cases for an ASP.NET application.

I have created a sample test project and have added NUnit latest version (3.6.1) and NUnitTestAdapter 2.1.1.

If I run the application by clicking on menu TestWindowsText Explorer , I am getting a blank screen in the Output Window . Why?

My code is:

[TestFixture]
public class SampleTest
{
    [Test]
    public void StringCheck()
    {
        string str = "Hello";
        Assert.That(str, Is.EqualTo("Hello"));
    }

    [Test]
    public void EmptyCheck()
    {
        string str = "siva";

        Assert.That(str, Is.EqualTo(string.Empty));
    }

    [Test]
    public void NumberCheck()
    {
        int i = 0;
        Assert.That(i, Is.EqualTo(0));
    }
}

You are using the adapter for the NUnit 2.x series, rather than the NUnit 3 adapter. NUnit versions 2 and 3 differ substantially, and there are two separate Visual Studio adapters to run the tests.

This is the one you'll need to run NUnit 3.6.1 tests:

NUnit 3 Test Adapter

I found the solution. The problem was with NUnit version (3.6.1). Now I am updated with NUnit 2.6.4. It is working for me.

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