-
-
Notifications
You must be signed in to change notification settings - Fork 111
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When you do the following:
- Group tests into different classes that have overlapping test method names
- Give those tests dependencies which have an overlapping test name
- Run specific subsets of those tests
It can occasionally trip up the Test Discovery phase and cause tests that do not execute to incorrectly appear in TestDiscoveryContext.AllTests.
Expected Behavior
- Run tests
ABCD.B2,ABCV.B1,ABCVC.B2, andVPCU.A1000 ABCV.B2is not included inTestDiscoveryContext.AllTestsABCV.B2is not executed
Actual Behavior
- Run tests
ABCD.B2,ABCV.B1,ABCVC.B2, andVPCU.A1000 ABCV.B2is included inTestDiscoveryContext.AllTestsABCV.B2is not executed
Steps to Reproduce
public class ABCD
{
[Test]
public async Task B1()
{
await Assert.That(true).IsEqualTo(true);
}
[Test]
public async Task B2()
{
await Assert.That(true).IsEqualTo(true);
}
}
public class VPCU
{
[Test, DependsOn<ABCV>(nameof(ABCV.B1))]
public async Task A1000()
{
await Assert.That(true).IsEqualTo(true);
}
}
public class ABCV
{
[Test]
public async Task A1()
{
await Assert.That(true).IsEqualTo(true);
}
[Test, DependsOn(nameof(A1))]
public async Task B1()
{
await Assert.That(true).IsEqualTo(true);
}
[Test, DependsOn(nameof(A1))]
public async Task B2()
{
await Assert.That(true).IsEqualTo(true);
}
}
public class ABCVC
{
[Test]
public async Task B0()
{
await Assert.That(true).IsEqualTo(true);
}
[Test, DependsOn(nameof(B0))]
public async Task B1()
{
await Assert.That(true).IsEqualTo(true);
}
[Test, DependsOn(nameof(B0))]
public async Task B2()
{
await Assert.That(true).IsEqualTo(true);
}
}
public static class TestSetup
{
[After(TestDiscovery)]
public static void Setup(TestDiscoveryContext context) => ...;
}TUnit Version
1.12.125
.NET Version
.NET 10
Operating System
Windows
IDE / Test Runner
Visual Studio
Error Output / Stack Trace
Additional Context
I played with this for a while to try and create the smallest reproduction, and this is what I came up with. I'm not entirely sure what triggers this situation to happen, but this example does reproduce it consistently.
IDE-Specific Issue?
- I've confirmed this issue occurs when running via
dotnet testordotnet run, not just in my IDE
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working