1 year ago
#326917
P. Tobey
"Result reported for unknown test case" from xUnit/dotnet test using Meziantou.Xunit.ParallelTestFramework
I've just added Meziantou.Xunit.ParallelTestFramework to several of my unit test projects (.NET Core 3.1), and am running them with dotnet test. Before the Meziantou.Xunit.ParallelTestFramework add, no odd messages from dotnet test; after add, I get a significant number of:
[xUnit.net 00:03:00.26] CoreApi.Tests: Result reported for unknown test case: CoreApi.Tests.ManualOpsControllerTests.FilterStationsForDiagnosticsTest(addressInt: 372230, suspended: null, channel: 2, terminal: 0, includeSatellite: False, filterSuspended: False, filterNotConnected: True)
-like messages, each for a different test instance. The tests are passing but the extra text in the build/test log is confusing/concerning. I haven't checked them exhaustively but they all seem to be xUnit tests using [Theory] and [MemberData(nameof(FilterDataGenerationMethod))].
Should I be worried? What can I do to help resolve this?
Update #1:
Yes, here are some of the details I can share:
- Declaration of the test:
[Theory]
// We have 7 parameters that we want to test in combination:
// Address - basically valid and invalid (0)
// Suspended - three values: true, false, null (should be treated as false)
// Channel - four value types: < 0, = 0, > 0, and null (treated as 0)
// Terminal - three value types: < 0, = 0, > 0
// IncludeSatellite - whether the Station.Satellite value is set to the satellite when call is made - true/false
// FilterSuspended - whether to filter suspended stations from the incoming list (true), or not (false)
// FilterNotConnected - whether to filter not-connected stations from the incoming list (true), or not (false).
// We generate this data using the xUnit MemberData attribute.
[MemberData(nameof(GenerateFilterData))]
public async Task FilterStationsForDiagnosticsTest(int addressInt, bool? suspended, int channel, short terminal,
bool includeSatellite, bool filterSuspended, bool filterNotConnected)
- Method generating test data:
/// <summary>
/// Generate the test data, as an enumerable of object arrays, to match the desired filter tests:
/// We have 7 parameters that we want to test in combination:
/// Address - basically valid and invalid (0)
/// Suspended - three values: true, false, null (should be treated as false)
/// Channel - four value types: < 0, = 0, > 0, and null (treated as 0)
/// Terminal - three value types: < 0, = 0, > 0
/// IncludeSatellite - whether the Station.Satellite value is set to the satellite when call is made - true/false
/// FilterSuspended - whether to filter suspended stations from the incoming list (true), or not (false)
/// FilterNotConnected - whether to filter not-connected stations from the incoming list (true), or not (false).
/// </summary>
/// <returns></returns>
public static IEnumerable<object[]> GenerateFilterData()
{
List<object[]> testObjects = new List<object[]>();
// Generate an AddressInt value.
foreach(int addressInt in new int[] { 0, 0x5ae06 })
{
foreach(bool? suspended in new bool?[] { null, false, true })
{
foreach(int? channel in new int?[] { null, -2, 0, 2 })
{
foreach(int terminal in new int[] { -3, 0, 3 })
{
foreach(bool includeSatellite in new bool[] { false, true })
{
foreach(bool filterSuspended in new bool[] { false, true })
{
foreach(bool filterNotConnected in new bool[] { false, true })
{
testObjects.Add(new object[]
{
addressInt, suspended, channel, terminal, includeSatellite, filterSuspended, filterNotConnected,
});
}
}
}
}
}
}
}
return testObjects;
}
Update #2
Thanks for the type tip. Reviewing the generated data found that I was passing an int rather than a short for "terminal". Correcting that corrected the issued. Much appreciated!
.net-core
xunit.net
0 Answers
Your Answer