Refactor Formatters to make Shutdown explicit#1033
Conversation
…interface definition of the Broker and Formatters. Sending the TestRunFinished message is no longer an implicit signal to shutdown the formatters.
| } | ||
| } | ||
|
|
||
| public async Task CompleteAsync() |
There was a problem hiding this comment.
Was IAsyncDisposable.DisposeAsync considered?
There was a problem hiding this comment.
Not for this PR, no. The intent of this PR is to make Publisher/Broker/Formatter shutdown explicit within the cooperation protocol among them. This call sequence when the test framework has caused the fixture shutdown to happen. That might, or might not, be within a disposal, depending upon the test framework.
But your comment spurs me to consider DisposeAsync for the other PR #1032
|
Marked this PR as draft; I would like to wait for feedback from @MrSoerenAndersen on discussion item #1030 which might lead to further changes/additions to this. In particular, @MrSoerenAndersen, would it be helpful to add public abstract Task OnCloseRequestedAsync();
public abstract Task OnCloseCompletedAsync();to It might be just as simple to mark |
|
To mark CloseAsync() as virtual would be sufficient for Expressium LivingDoc as long as the final NDJSON file is closed...
|
Almost. Call base first... await base.CloseAsync();
# ... the rest of the override |
🤔 What's changed?
The interface definitions of the Broker and FormatterBase have been modified to add explicit methods for closing.
Sending the TestRunFinished message is no longer an implicit signal to shutdown the formatters.
The Publisher will call the Broker's CompleteAsync() method which will forward that call to each active formatter by invoking their CloseAsync() methods.
⚡️ What's your motivation?
Makes the design more explicit.
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
📋 Checklist:
This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.