NUnit Generic TestFixture

I have a few test fixtures that are generic, and it doesn't seem like ReSharper does a good job of handling them.  An example:

    [TestFixture(typeof(int))]
    [TestFixture(typeof(string))]
    public class TypeTests
    {
        [Test]
        public void DerivesFromObject()
        {
            Assert.That(typeof(T).IsValueType);
        }
    }

Even though there's a single test method, this will result in two distinct test runs.  One will fail, and the other will succeed.  ReSharper is clearly running all the test runs, because my tests fail, but won't tell me which test fails.  Clicking on the node for the test fixture in ReSharper's Unit Test Sessions window displays simply "TypeTests: Failed," and the node for the test itself remains gray and offers no output or feedback at all.  TestDriven.Net is the clear winner here - the UI isn't pretty, but it provides the following, much more informative output:

TestCase 'ClassLibrary1.TypeTests`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].DerivesFromObject'
failed: 
  Expected: True
  But was:  False
    Class1.cs(16,0): at ClassLibrary1.TypeTests`1.DerivesFromObject()


1 passed, 1 failed, 0 skipped, took 0.45 seconds (NUnit 2.5.2).


Any chance of ReSharper supporting generic tests a little better?

1 comment
Comment actions Permalink

Hello Dathan,

This is also a known problem and it should also be addressed in the next
major ReSharper release. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I have a few test fixtures that are generic, and it doesn't seem like
ReSharper does a good job of handling them.  An example:


public class TypeTests
{

public void DerivesFromObject()
{
Assert.That(typeof(T).IsValueType);
}
}
Even though there's a single test method, this will result in two
distinct test runs.  One will fail, and the other will succeed.
ReSharper is clearly running all the test runs, because my tests fail,
but won't tell me which test fails.  Clicking on the node for the
test fixture in ReSharper's Unit Test Sessions window displays simply
"TypeTests: Failed," and the node for the test itself remains gray and
offers no output or feedback at all.  TestDriven.Net is the clear
winner here - the UI isn't pretty, but it provides the following, much
more informative output:

TestCase 'ClassLibrary1.TypeTests`1[[System.String, mscorlib,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]].DerivesFromObject'
failed:
Expected: True
But was:  False
Class1.cs(16,0): at ClassLibrary1.TypeTests`1.DerivesFromObject()
1 passed, 1 failed, 0 skipped, took 0.45 seconds (NUnit 2.5.2).

Any chance of ReSharper supporting generic tests a little better?

---
Original message URL:
http://devnet.jetbrains.net/message/5275001#5275001



0

Please sign in to leave a comment.