NUnit test runner does not properly break out tests using TestCaseSourceAttribute even though bug is marked as fixed.

RSRP-183263 discusses that tests using the TestCaseSourceAttribute are not broken into individual tests (the tests are marked as passed or failed as a group with no way to identify exactly which test failed or why). This was closed as a duplicate of RSRP-149085 (which actually refers to TestFixtureAttribute instead of the TestCaseSourceAttribute). Now the latter (referring to TestCaseFixtureAttribute) is closed as fixed in the EAP. But testing with today's EAP build (2114) this is emphatically not fixed for the TestCaseSourceAttribute.

One of these issues needs to be reopened until this is fixed.

Here is sample code demonstrating the issue:

[TestCaseSource("AdditionTestCases")]
public int TestAddition(int i, int j) {
    return i + j;
}
 
public IEnumerable AdditionTestCases() {
    yield return new TestCaseData(1, 3).Returns(4).SetDescription("Should pass.");
    yield return new TestCaseData(1, 3).Returns(7).SetDescription("Should fail.");
}
2 comments

Hello Lawrence,

Thank you for noticing this! I've reopened RSRP-183263 with highest priority
and we're going to look into this problem soon.

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

http://youtrack.jetbrains.net/issue/RSRP-183263 discusses that tests
using the TestCaseSourceAttribute are not broken into individual tests
(the tests are marked as passed or failed as a group with no way to
identify exactly which test failed or why). This was closed as a
duplicate of http://youtrack.jetbrains.net/issue/RSRP-149085 (which
actually refers to TestFixtureAttribute instead of the
TestCaseSourceAttribute). Now the latter (referring to
TestCaseFixtureAttribute) is closed as fixed in the EAP. But testing
with today's EAP build (2114) this is empathetically not fixed for the
TestCaseSourceAttribute.

One of these issues needs to be reopened until this is fixed.

Here is sample code demonstrating the issue:

 
> [TestCaseSource("AdditionTestCases")]
> public int TestAddition(int i, int j) {
> return i + j;
> }
> public IEnumerable AdditionTestCases() {
> yield return new TestCaseData(1, 3,
> 4).SetDescription("Should pass.");
> yield return new TestCaseData(1, 3,
> 7).SetDescription("Should fail.");
> }
> ]]>


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



0

Hi Andrey,
Have you found the solution to this issue yet?

What I found also is that when I use SetName() method of TestCaseData, the tests get ignored when I run the test case. Here's an example:

public class TestCasesData
{
  public static IEnumerable Data
  {
    get
    {
      yield return new TestCaseData(1).Throws(typeof(ArgumentNullException)).SetName("Test 1").SetDescription("Test 11");
      yield return new TestCaseData(2).Throws(typeof(ArgumentNullException)).SetName("Test 2").SetDescription("Test 12");       yield return new TestCaseData(3).Throws(typeof(ArgumentNullException)).SetName("Test 3").SetDescription("Test 13");     }   } }


UPDATE: I just installed R# 6.0 and it seems that the problem I mentioned above is fixed too. However I noticed another problem. Test cases with TestCaseSourceAttribe have green checkmark icon, but at the top of tests in Unit Test Session window those test cases are counted as "ignored".

0

Please sign in to leave a comment.