Running NUnit tests - how can make your test-runner display the TestCase that failed?

When using ReSharper's test-running to run NUnit unit tests, if I have multiple TestCase attributes for a single test method, and the test fails for some of those test cases - it doesn't show what what the failure was - usually. Is there a way to achieve this?  It is a very tedious process to comment-out TestCases to narrow it down to the failing one, as it is. !

I'm using Visual Studio 2010 SP1 Ult, and ReSharper 5.1.3  NUnit is the latest version. I love the ability to run my unit-tests by right-clicking on a test class and selecting "Run Unit Tests".

Here is a simplified code-example for one of my unit-tests:

        [TestCase('*', "asterisk")]
        [TestCase('~', "tilde")]
        //[TestCase('`', "left-quote")]
        [TestCase('!', "exclamation-mark")]
        public void CharName_MyriadArgs(char ch, string expectedName)
        {
            string actualOutput = ch.CharName();
            Assert.AreEqual(expectedName, actualOutput);
        }

With more than one TestCase defined (as above), it usually (but not always) only says that it failed - not what the parameters were. Thus, I have to narrow it down by commenting out those TestCase lines, as shown above where I've commented out the 3rd TestCase.  This is extremely time-consuming, as in some cases I have huge numbers of TestCases defined.

Is there a better way?

Attached are 2 screenshots - one showing failure information, the other not.



Attachment(s):
TestRunner_ShowingError2.png
TestRunner_ShowingError.png
1 comment

Hello James,

TestCase attribute will be fully supported in the upcoming ReSharper 6 which
will show those test as different nodes. You can already download the nightly
builds of ReSharper 6 at http://tinyurl.com/6jrespl. Thank you!

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

When using ReSharper's test-running to run NUnit unit tests, if I have
multiple TestCase attributes for a single test method, and the test
fails for some of those test cases - it doesn't show what what the
failure was - usually. Is there a way to achieve this?  It is a very
tedious process to comment-out TestCases to narrow it down to the
failing one, as it is. !

I'm using Visual Studio 2010 SP1 Ult, and ReSharper 5.1.3  NUnit is
the latest version. I love the ability to run my unit-tests by
right-clicking on a test class and selecting "Run Unit Tests".

Here is a simplified code-example for one of my unit-tests:

[TestCase('*', "asterisk")]
[TestCase('~', "tilde")]
//[TestCase('`', "left-quote")]
[TestCase('!', "exclamation-mark")]
public void CharName_MyriadArgs(char ch, string expectedName)
{
string actualOutput = ch.CharName();
Assert.AreEqual(expectedName, actualOutput);
}
With more than one TestCase defined (as above), it usually (but not
always) only says that it failed - not what the parameters were. Thus,
I have to narrow it down by commenting out those TestCase lines, as
shown above where I've commented out the 3rd TestCase.  This is
extremely time-consuming, as in some cases I have huge numbers of
TestCases defined.

Is there a better way?

Attached are 2 screenshots - one showing failure information, the
other not.

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



0

Please sign in to leave a comment.