Build/Test Issues

NUnit3 Retry attribute

Started by Grendil on 7,163 views

We're looking at using NUnit3's Retry attribute to retry some flaky specflow tests. I'm wondering how this will work with NCrunch (including the console version) and if there is any better way to get NCrunch to retry flaky tests.

Also, we may have to write a custom NUnit Retry attribute to expand the behavior of the normal one (something along the lines of this post: https://testingrepository.com/retry-failed-tests-in-nunit) so I'm also wondering if NCrunch would properly handle any NUnit attributes like these.
In theory, the logic of this attribute should be handled internally by NUnit and shouldn't require any involvement from NCrunch. I can't say that I've specifically tested it, but I can't tell you any reason why it wouldn't work. I recommend giving it a try.

Again, in theory, I can't think of anything that would prevent you from writing your own extended version of RetryAttribute. As long as NUnit's code picked this up and invoked it in the same way as the normal RetryAttribute, there is a good chance it will work. I am a little less certain of this one in the sense that extending NUnit in the past hasn't always worked out so well for NCrunch, because it steps into untested behaviour.

This is all under the assumption that you're doing this in NUnit V3.
Great, that's just the feedback I was looking for, thanks. I think we'll give it a try.

Post a reply

Log in to reply.