Skip to content

How to retry failing tests? #2905

Discussion options

You must be logged in to vote

We have a sample that does this: https://github.com/xunit/samples.xunit/tree/main/RetryFactExample

What's happening here is that the message listener in the runner is seeing you run the test multiple times, because you're letting it see the result messages from both the failures and the successes. Our sample shows using a "delayed message bus" so that it hangs onto all the messages while the test runs, and will only ever send those messages along if the test passes, or if the fail count exceeds the limit.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@mmateevadeltek
Comment options

Answer selected by mmateevadeltek
Comment options

You must be logged in to vote
1 reply
@bradwilson
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants