-
-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Description
dynamic test generation does not honor base class NotInParalel and all dynamically generated tests run in paralel
sample pseudo code:
`
[NotInParalel]
public class BaseTest
{}
public class Tests : BaseTest
{
[DynamicTestBuilder]
public static void getDynamicTests(DynamicTestBuilderContext context)
{
foreach (var type in typeof(xxx).Assembly.GetExportedTypes())
{
if (type.IsClass == false || type.IsAbstract == true)
continue;
context.AddTest(new DynamicTest<Tests>
{
TestMethod = @class => @class.TestMethod(DynamicTestHelper.Argument<Type>()),
TestMethodArguments = [type],
DisplayName = $"dynamic test for {type.Name}",
//Attributes = [new NotInParallelAttribute()]
});
}
}
public async TestMethod(Tyoe)
{}
}
`
With attributes commented out - tests run in paralel, ignoring base class attribute, only manually repeating attributes from base class ends in expected behaviour
Expected Behavior
class attributes should be honored
Actual Behavior
class attributes are ignored
Steps to Reproduce
as above
TUnit Version
1.7.0
.NET Version
10
Operating System
Windows
IDE / Test Runner
dotnet CLI (dotnet test / dotnet run)
Error Output / Stack Trace
Additional Context
No response
IDE-Specific Issue?
- I've confirmed this issue occurs when running via
dotnet testordotnet run, not just in my IDE