-
Notifications
You must be signed in to change notification settings - Fork 759
Added StopOnFailure Parameter to RepeatAttribute
#4864
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
Added StopOnFailure Parameter to RepeatAttribute
#4864
Conversation
|
@dotnet-policy-service agree company="Sparks Solutions GmbH" |
manfred-brands
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cfuerbachersparks. The actual change to functionality and tests looks good.
I have 2 requests for changes, see individual comments.
| /// <param name="count">The number of times to run the test</param> | ||
| public RepeatAttribute(int count) : base(count) | ||
| /// <param name="stopOnFailure">Whether to stop when a test is not successful or not</param> | ||
| public RepeatAttribute(int count, bool stopOnFailure = true) : base(count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is non-backward change for already compiled code. You need to keep the original constructor, it can call the new ones. This also means you have to make the stopOnFailure parameter non-optional in the new constructor.
Personally, I prefer a syntax where I can say: [Repeat(5, StopOnFailure = true)] as a clear indication what the boolean means. You can add a StopOnFailure property so users can choose which way they prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made StopOnFailure a property, restored old ctor and created a new one with non-optional parameter
…one with non-optional parameter
manfred-brands
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cfuerbachersparks.
One more item, can you add a unit test which uses the attribute and sets the StopOnError property, one each for false and true
added two unit tests |
manfred-brands
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Looks good now.
Changes to always repeat a test x times.
Fixes #4861.