Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper unit test runner gives Inconclusive to the outer class

I have unit tests written using nUnit and tests are structured in a similar way as in Phil Haack's post

namespace MyNamespace
{
    [TestFixture]
    public class ClassToTest
    {
        [TestFixture]
        public class MethodToTest
        {
            [Test]
            public void ThrowsArgumentNullException_OnNullIndex()
            {
                ...
            }

            .. more tests for the method ..
        }

        [TestFixture]
        public class AnotherMethodToTest
        {
            [Test]
            public void ThrowsArgumentNullException_OnNullIndex()
            {
                ...
            }

            .. more tests for the method ..
        }
    }
}

My problem is that I get inconclusive for the outer class that is used to group unit tests. I have tried with and without [TestFixture] on the outer and/or inner class, but it is always giving me Inconclusive.

I think the correct behavior should be to display unit test states from the inner class tests. Any ideas?

Inconclusive is appearing for the outer class

Update

One ugly fix seems to be creating a dummy test to the outer class and then put attribute Ignore on it.

[Test, Ignore]
public void DummyTest()
{
    Assert.IsTrue(true);
}

Update 2

Channs & Wayne are correct, outer class is just used for grouping, so changing from class to namespace is the best solution.

like image 259
Tx3 Avatar asked Aug 01 '12 13:08

Tx3


3 Answers

Your outer class only groups the related methods, suggest replacing it by a namespace.

namespace MyNamespace.ClassToTest
{
  ...
}
like image 183
Channs Avatar answered Nov 14 '22 23:11

Channs


You probably have a [TestFixture] with no [Test]s -- maybe the outer class doesn't have any of its own tests? In which case, why not just use a namespace?

like image 21
lesscode Avatar answered Nov 15 '22 00:11

lesscode


just a guess, the attribute on the class causes your class to be handled as a testclass, but there are no test in the class it self causes our Inconclusive:

[TestFixture]     
public class ClassToTest
like image 1
Peter Avatar answered Nov 15 '22 00:11

Peter