-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Introduce TestRunAwareTestListener #3381
Introduce TestRunAwareTestListener #3381
Conversation
Adds startTestRun and endTestRun hooks to TestListener so implementing classes don't have to check whether a startTestSuite call is the first one, plus it allows implementers to do something after the very last test, which is usefull for implementers that want to buffer data and only output once everything is done.
Codecov Report
@@ Coverage Diff @@
## master #3381 +/- ##
============================================
+ Coverage 82.95% 82.97% +0.01%
- Complexity 3569 3580 +11
============================================
Files 143 143
Lines 9499 9513 +14
============================================
+ Hits 7880 7893 +13
- Misses 1619 1620 +1
Continue to review full report at Codecov.
|
|
Maybe I should have documented the fact that the legacy Units of code that want to observe test execution should use the new |
Okay, so basically I've made the lagacy code forward compatible? 😄 Okay, if the The printers are currently all implemented as The whole point of this PR was to get a signal in the CliTestDoxPrinter when the last test had run so we could output any buffered content, required for #3380; my idea was to create a BufferedTestListener as a decorator for other Also, I don't like using The interfaces exist, now it's a matter of figuring out how to best use them to solve this, I think. |
@rpkamp Perhaps the caching listener (or listening cache? :) can be of some inspiration too:
It started off as a version of the old listener-printer structure, then @sebastianbergmann asked to refactor it more cleanly before merge. Works like a charm. |
@epdenouden yes, that looks good. However, since that's an extension and the printer is a TestListener I'd need an adapter. I'd like a decorator instead, but for that to work the printer would need to be an extension too 🙂 |
Adds startTestRun and endTestRun hooks to TestListener so implementing
classes don't have to check whether a startTestSuite call is the first
one, plus it allows implementers to do something after the very last
test, which is usefull for implementers that want to buffer data and
only output once everything is done.