Bug Report T442314
Visible to All Users

The Unit Test Runner does not recognize the NUnit3 TestCaseSource attribute

created 8 years ago

Given the following code:

C#
public class Tests { [Test, TestCaseSource("GetTestDefinitions")] public void Test(TestDefinition definition) { Assert.AreEqual(definition.Value1, definition.Value2); } public static IEnumerable GetTestDefinitions() { return new[] { new TestDefinition { Value1 = "0", Value2 = "0" }, new TestDefinition { Value1 = "0", Value2 = "1" }, new TestDefinition { Value1 = "1", Value2 = "0" }, new TestDefinition { Value1 = "1", Value2 = "1" }, }; } public class TestDefinition { public string Value1 { get; set; } public string Value2 { get; set; } } }

The 4 tests are not properly represented in the Test Runner:

* Only one test appears
* Its name matches the test case method signature
* If there are failing tests it still shows green (this one is the biggest problem for me)

The output pane shows that all tests were executed:  Summary: Passed: 2, Failed: 2, Ignored: 0

Note: ticket T418389 seems to be reporting the same problem but with a focus on the TestCaseData name attribute

Show previous comments (1)

    I think I had tried that but for some reason I wasn't able to make it work.

    Anyway, I was now able to do it. Thanks a lot for the response and the workaround.

    DevExpress Support Team 8 years ago

      You are welcome. We are doing our best to fix this problem and will notify you of our progress shortly.

      DevExpress Support Team 8 years ago

        Hi Jorge,

        We found that the fix for this issue has some side effects. We need some time to make and test additional changes. So, we have decided to exclude this fix from the nearest 16.1.9 release. We will make every effort to finally solve this problem in the 16.1.10 release. Your patience is greatly appreciated.

        Answers approved by DevExpress Support

        created 8 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.