-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow tests to be executed in a user-defined thread #20
Comments
Hi @debruyckere, Thanks for raising this issue. We are already considering providing a mechanism for test extensions to influence the way tests are physically executed. Once we begin work on this front, we'll post back here. Regards, Sam |
Looks like relates to #157, I tried to have a custom engine for this issue. This engine delegates to jupiter like:
works well by itself but as discovery mechanism is the same, all tests are discovered twice. This problem could be solved with EngineFilters but unfortunately engine filters are not provided as extensions: one can register them on launcher request or for JUnitPlatform runner. Even if IDE would allow to take this parameter from some configuration, it won't work good (cause this configuration can't be retrieved from the code). Frankly saying I don't want to invent my own annotations with all discovery and execution staff. Any ideas how to deal with this or should we just wait for this issue to be resolved? |
I think it's best to wait for this issue to be resolved. |
Note: this is very closely related to #157 and potentially a duplicate. |
Closing this issue as superseded by #157. Please continue the discussion on this topic there. |
Overview
In JUnit 4, we use a specific test runner that runs the test code on a dedicated UI thread, such as the AWT/Swing thread (or the JavaFX thread). This avoids cluttering your code with
EventQueue.invokeAndWait
all over the place. As far as I understood, the current extensions proposal does not allow to do such thing.The below runner simply wraps all calls to before, after, and test methods in an
EventQueue.invokeAndWait
call. Tests simply have to declare@RunWith(AWTThreadRunner.class)
to get this behavior.Note: the actual implementation is a bit more complex in that it does proper exception handling and refuses JUnit's time-outs as that doesn't work together with running on a dedicated thread.
Related Issues
The text was updated successfully, but these errors were encountered: