-
Notifications
You must be signed in to change notification settings - Fork 815
Open
Labels
FeatureA request for a new featureA request for a new feature
Description
I want to gets actual
/expected
instance data when xUnit assertion failed.
And report custom diffs as test attachments.
Currently it need to add try-catch block capture these information.
So I want extensibility point to hook assertion failure event.
Expected Usage
public class ReportDiffOnFailedAttribute : BeforeAfterTestAttribute
{
public override void Before(MethodInfo methodUnderTest, IXunitTest test)
{
// Add custom hook that is ivoked when assertion failed
TestContext.Current.OnAssertionFailed = (string assertionName, object? actual, object? expected) =>
{
// Generate actual/expected diffs and add results to attachments.
};
}
}
Similar Issues
Metadata
Metadata
Assignees
Labels
FeatureA request for a new featureA request for a new feature