-
-
Notifications
You must be signed in to change notification settings - Fork 108
Clearer Data Injection Failure Messages #4187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SummaryAdds early-exit logic to detect tests that failed during registration and reports them with clearer error messages showing the full exception chain. Critical IssuesNone found Code ReviewTestCoordinator.cs Changes: The early-exit check (lines 68-76) is correctly positioned AFTER context restoration but BEFORE result clearing. It properly checks test.Context.Execution.Result which is set by TestBuilderPipeline.cs when creating FailedExecutableTest instances. PropertyInjector.cs Context: The exception wrapping at PropertyInjector.cs:197-201 provides nested context that creates a chain like: Failed to inject properties for type DataSource to Failed to inject properties for type DataSource2 to Oops something went wrong Test Coverage: DataSourceExceptionPropagationTests.cs validates nested property injection failures are properly reported with error messages containing the original exception and the nested injection path. Test is properly marked as failed with correct counters. Test Implementation: NestedDataSourcesThrow.cs creates a realistic scenario with DataSource to DataSource2 to DataSource3 where the constructor throws. TUnit Rules ComplianceNo source generator changes, no snapshot updates needed. No public API changes. No VSTest usage. No reflection without AOT annotations. No performance concerns - early-exit improves performance. VerdictAPPROVE - Clean implementation that improves error reporting |
Description
Related Issue
Fixes #
Type of Change
Checklist
Required
TUnit-Specific Requirements
TUnit.Core.SourceGenerator)TUnit.Engine)TUnit.Core.SourceGenerator.Testsand/orTUnit.PublicAPItests.received.txtfiles and accepted them as.verified.txt.verified.txtfiles[DynamicallyAccessedMembers]annotationsdotnet publish -p:PublishAot=trueTesting
dotnet test)Additional Notes