Hi,
With xunit, when you have Th eory tests that have a MemberData or ClassData attribute that specifies data from a class, only a single test is shown.
Example:
C#using System;
using System.Collections.Generic;
using Xunit;
namespace TestRunner.b
{
public class MemberData
{
[Theory]
[MemberData(nameof(AllValues))]
public void Test1(Data data)
{
Assert.True(data.Value % 2 == 0);
}
public static IEnumerable<object[]> AllValues()
{
return new[]
{
new object[]{ new Data(1) },
new object[]{ new Data(2) },
new object[]{ new Data(3) },
new object[]{ new Data(4) }
};
}
}
}
Observed behavior:
* Only one Test is show in the Test Runner ("Test1") and it's green
* In the test runner output window everything looks fine: "Summary: Passed: 2, Failed: 2, Ignored: 0"
Expected behavior:
* Number of tests in the test runner should be correct (4)
* If any of those fail it should be red
* The output from all tests should be available in the detail pane
* Showing all tests in the tree is not something I'm expecting (4 entries instead of just one) but maybe it should be consistent with the other Theory tests.
Additional issues that may be related:
* Double clicking "Test1" doesn't go to the source code after you run the tests
* Sometimes "Test1" ghost tests appear even in scenarios that work (check the MemberDataWithSimpleTypes class in the attached project)
Attached is a project that exemplifies the problem with both MemberData and ClassData, and an example that works with simple types (int).
Hello,
Thank you for providing the code sample and your explanation.
I have reproduced the issues on my side.
We will research it and let you know as soon as we have any results.
Hello,
Additional research showed that working on this issue is quite a resource consuming task, so we need some additional time to fix this issue.
We will notify you when we make any progress.
It's not urgent. Happy Holidays!
Thank you for the update and understanding. Happy Holidays!