-
Notifications
You must be signed in to change notification settings - Fork 20
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
Chill should use the xUnit IAsyncLifetime #80
Comments
It could be improved indeed, but what problem are you facing with the current implementation? |
The #77 was a hacky way of solving that particular issue, but if this (proposal in the current issue) were implemented in the first place we would not have these problems. It is just a suggestion for the proper way of solving it. At the time of #77 I didn't know about PS: Also, asynchronous work would properly distribute on the thread pool and not block the threads executing the constructors of the test classes. |
True, but it will also tie Chill to xUnit. |
True, but maybe an additional package can be provided for this functionality. With Async variants of GivenWhenThen particular to xUnit (eg AsyncGivenWhenThen). The main package can then discourage the use of Just an idea/suggestion for the future, nothing mandatory. |
I'm in doubt whether the extra complication will confuse people and is warranted. What problem do you think people are facing? |
Yes, I don't know either. For us, it isn't needed, but just felt it would be good to share this idea. A concrete example (besides what was fixed in #77) is that we are doing very-long-running (5 minutes) operations in our setup for the specs (inside the constructors). We have a lot of these specs (lets say 10). xUnit limits the number of constructors of test classes that can run at a given time (lets say 5). Because these specs of ours take so damn long, we basically block any other test from starting up (Chill waits for the async work to finish by blockign the ctor threads). If this work would be delegated to |
Any async work declared inside a Given/When inside the ctor of test classes will be waited for by blocking the thread on which the constructor is executing. This is against all the asynchronous programming best practices. Chill should use the
IAsyncLifetime
to do real async work during initialization, see https://mderriey.com/2017/09/04/async-lifetime-with-xunit/.GivenWhenThen
can easly implementIAsyncLifetime
and it can "gather" work (fromGiven/When
) to be executed duringIAsyncLifetime.InitializeAsync
The text was updated successfully, but these errors were encountered: