You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ideally I can replace the code above by the following. Note, non-async counterparts are also useful.
await Assert.ToBeEqualAsync(T expected, Func<Task<T>> retryFunction, string message);
await Assert.ToBeTrueAsync(Func<Task<T>> retryFunction, string message);
// and this where the function should not throw an error
Assert.ToPass(Action retryFunction, string message);
await Assert.ToPassAsync(Func<Task> retryFunction, string message);
The text was updated successfully, but these errors were encountered:
Exoow
changed the title
Asserts supporting auto-retry/polling
[Feature] Asserts supporting auto-retry/polling
Feb 1, 2024
I have to admit I am personally not fan of this feature request as I believe the assertion should only check values and that there are already many retry solutions available out there (e.g. https://github.com/App-vNext/Polly).
But I will keep this open for some time to collect thumbs up/down.
Hello @Evangelink - I understand, considering retries are only applicable in test levels beyond unit tests.
The Polly library seems a bit overkill in terms of syntax/features for simple asserts.
In case this doesn't make it, I'll stick to my own extension methods. Thanks for your feedback! :)
Summary
Provide Assert methods that automatically retry the given function to assert until timeout.
Background and Motivation
Currently, my test code has asserts like these:
These are custom extensions that simply wrap around a Retry object that polls until success or a timeout.
Proposed Feature
Ideally I can replace the code above by the following. Note, non-async counterparts are also useful.
The text was updated successfully, but these errors were encountered: