NUnit TestCase Bug

I found several attributes that Resharper doesn't support with the NUnit TestCase Attribute. One of which I'd consider a defect.

[TestCase(12, 3, Result = 4)]
[TestCase(12, 2, Result = 6)]
public int DivideTest(int n, int d)
{
    return (n / d);
}


If you add TestName, it results in Ignored:


[TestCase(12, 3, Result = 4, TestName = "4")]
[TestCase(12, 2, Result = 6, TestName = "6")]
public int DivideTestIgnored(int n, int d)
{
    return (n / d);
}


If you have at least one TestCase missing TestName it passes:

[TestCase(12, 3, Result = 4, TestName = "4")]
[TestCase(12, 2, Result = 6)] //Missing TestName
public int DivideTestMissingTestName(int n, int d)
{
    return (n / d);
}


BUT, if the test FAILS, as in the TestCase below, it will show the test as PASSED


[TestCase(12, 3, Result = 5, TestName = "Should fail but doesn't")]
[TestCase(12, 2, Result = 6)]
public int DivideTestFailure(int n, int d)
{
    return (n / d);
}


I've verified that this occurs in build 5.1.3000.

1 comment

Hello Alan,

Thank you for reporting! This problem should be fixed in the upcoming ReSharper
6.0. You can download the latest nightly build at http://tinyurl.com/6jrespl.


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

I found several attributes that Resharper doesn't support with the
NUnit TestCase Attribute. One of which I'd consider a defect.

 4)]
> [TestCase(12, 2, Result = 6)]
> public int DivideTest(int n, int d)
> {
> return (n / d);
> }]]>

If you add TestName, it results in Ignored:

 [TestCase(12, 3, Result = 4, TestName = "4")]
> [TestCase(12, 2, Result = 6, TestName = "6")]
> public int DivideTestIgnored(int n, int d)
> {
> return (n / d);
> }
> ]]>


If you have at least one TestCase missing TestName it passes:

 4, TestName = "4")]
> [TestCase(12, 2, Result = 6)] //Missing TestName
> public int DivideTestMissingTestName(int n, int d)
> {
> return (n / d);
> }]]>

BUT, if the test FAILS, as in the TestCase below, it will show the
test as PASSED

 [TestCase(12, 3, Result = *5*, TestName = "+*Should fail but
> doesn't*+")]
> [TestCase(12, 2, Result = 6)]
> public int DivideTestFailure(int n, int d)
> {
> return (n / d);
> }]]>

I've verified that this occurs in build 5.1.3000.

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



0

Please sign in to leave a comment.