Rank: Newbie
Groups: Registered
Joined: 8/30/2017(UTC) Posts: 1 Location: United States of America
|
There seems to be a problem running NUnit 3.6.1 tests using unnamed TestCases. In these two test cases, the second test is passing when it should be failing. Quote: [TestFixture] public class SampleArrayTests {
[TestCase(new int[] { 5, 2, 7, 8 }, TestName = "good1")] [TestCase(new int[] { 9, 0, 1 }, TestName = "bad")] [TestCase(new int[] { 5, 6, 7, 8 }, TestName = "good2")] public void TestCasesWithNames_Arr(int[] array) { Assert.That(array.Length, Is.EqualTo(4)); }
[TestCase(new int[] { 5, 2, 7, 8 })] [TestCase(new int[] { 5, 6, 7, 8 })] [TestCase(new int[] { 9, 0, 1 })] public void TestCasesWithoutNames_Arr(int[] array) { Assert.That(array.Length, Is.EqualTo(4)); }
}
Change the order of the TestCases in the second test and it will pass or fail at random. If you copy/paste the second test into another test, the second will fail. Quote:
[TestFixture] public class SampleArrayTests {
[TestCase(new int[] { 5, 2, 7, 8 }, TestName = "good1")] [TestCase(new int[] { 9, 0, 1 }, TestName = "bad")] [TestCase(new int[] { 5, 6, 7, 8 }, TestName = "good2")] public void TestCasesWithNames_Arr(int[] array) { Assert.That(array.Length, Is.EqualTo(4)); }
[TestCase(new int[] { 5, 6, 7, 8 })] [TestCase(new int[] { 9, 0, 1 })] [TestCase(new int[] { 5, 6, 7, 8 })] public void TestCasesWithoutNames_Arr(int[] array) { Assert.That(array.Length, Is.EqualTo(4)); }
[TestCase(new int[] { 5, 6, 7, 8 })] [TestCase(new int[] { 9, 0, 1 })] [TestCase(new int[] { 5, 6, 7, 8 })] public void TestCasesWithoutNames_Arr2(int[] array) { Assert.That(array.Length, Is.EqualTo(4)); }
}
|