-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[Core] Allow runner to register bus as concurrent or serial event source #1656
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
[Core] Allow runner to register bus as concurrent or serial event source #1656
Conversation
No idea why the some JDKs suddenly get
but perhaps we can debug that once the rest of the code is acceptable. |
That happens when event's are send to the pretty formatter in the wrong order. The junit runner and test ng runner are reimplementations of the runtime. They don't use the Not sure how to detect when they are being ran in parallel. |
Hmm; also can't seem to find here how to detect the number of threads JUnit4 will use; So I'm not sure this approach will work without specific support for JUnit and TestNG. I'll let it rest for a while. |
We don't need to know the exact number of threads. Only if the execution is not guaranteed to be serial. For JUnit I'm at a loss for TestNG as well. But we could go with the assumption that it runs in parallel by default. |
Pushed a thing. I'm rather unhappy about the structure of it, but it works. It is beocmming apparent that immediately subscribing the plugins to the event bus is problematic. Would need to think about the structure. |
Cool! So guess this means the PR as is at least fixes the immediate pretty text output for CLI and JUnit, and for TestNG anyone that needs it can come along and fix that once reported. You mention you're unhappy about the structure; Is that something you still want to tackle in this PR, or make a note of in an item and tackle later? I noticed there's a lot of work amassed in the |
The primary difference between v4 and v5 is the package structure. Refactorings have been rather trivial to port over so far. After a few do overs you get the hang of it quite quickly. So that hasn't been a bother yet. I was planning to EOL 4.x.x in June this year to burn out the last few bugs but there has been a splurge of contributions and fixes recently. So I'm going to reset that timer. Additionally the upgrade to V5 a significant breaking change. I'd like to give the world a heads up and a chance to contribute some deprecations to allow for a graceful migration. I'm holding of on JUnit 5 until then. I would like to overhaul Cucumbers resource loading/class path scanning first. Which will be much easier to do once we can use Java 8. By then it will probably be easier to redo the JUnit 5 implementation from scratch. |
And to answer the question. Yes, this is something I would like to tackle. There are a few requirements:
So I'm thinking It's mostly a plumbing job. |
We've got a slack btw. https://cucumberbdd-slack-invite.herokuapp.com/ |
@mpkorstanje think I've updated the MR according to your suggestions; could you check if this matches what you were aiming for? |
Pushed some minor edits and reduced the diff via github. Lets see if the test pass. 😆 |
All passed. Thanks for putting the time into this. |
My pleasure! :) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #1515
Summary
As discussed in #1515 the pretty text output for cli/junit/testNg is also delayed for users running on a single thread from their IDE or commandline. This small change restores immediate text output when running on a single thread, only delaying when multiple threads are involved.
A better fix would be an overhaul of the PrettyFormatter, but that's considerably more work, whereas this would fix a lot of the same use cases.
Details
Do not create or use the CanonicalOrderEventPublisher for plugins when running on a single thread.
Motivation and Context
It ensures
non-ConcurrentEventListener
plugins get events immediately when running on a single thread, rather than delayed until all tests are run.How Has This Been Tested?
Not yet, as it might be considered too hacky.
Types of changes
Checklist: