refactor(tests): Use JUnit Jupiter mechanisms to handle general test setup and reporting#1543
Merged
Conversation
Contributor
Author
|
I have quite a few more changes lined up to make our tests less flaky but I did not want to make one mega PR 😄 |
Contributor
Author
|
This should be good to go. The existing failures also exist on main. |
Contributor
|
@FlorianKroiss , I am not very familiar with JUnit best practices and extensions. Why do you think this is better that what LSP4E was doing so far? Could you explain it for a dummy user of JUnit? |
Contributor
Author
|
@rubenporras It's basically about using the right callback for each purpose.
|
rubenporras
reviewed
Jun 5, 2026
Contributor
Thanks, could you add this explanation to the PR and commit message? |
2c2b90c to
6b7d87d
Compare
rubenporras
approved these changes
Jun 5, 2026
…setup and reporting - The `junit.jupiter.extensions.autodetection.enabled=true` configuration automatically loads all listeners/extensions defined in META-INF/services. For example, we previously used the `TestInfoExtension` to log when a test starts. However, for this to work, you either had to manually add the extension to your test class or extend AbstractTest. Otherwise there would have been no output. - `CloseIntroExtension` is now a regular Extension which just makes sure the Intro is closed. This has the same advantage, that you don't have to use it explicitly or inherit from AbstractTest - `LoggingTestExecutionListener` is now used to report when a test case or test container starts/finish. This implements `TestExecutionListener` which has the advantage that it is called for each test, even for skipped ones and that you also get access to the result of the test case execution, which is something you cannot do with something like beforeEach/afterEach. - `LoggingLauncherSessionListener` is now used to redirect stderr and configure the java.util.logging. This implements `LauncherSessionListener` which is only called once per test session, instead of previously being done before each test case.
6b7d87d to
ace14b9
Compare
Contributor
Author
|
Sorry, I forgot to commit some removed code. |
rubenporras
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
junit.jupiter.extensions.autodetection.enabled=trueconfiguration automatically loads all listeners/extensions defined in META-INF/services. For example, we previously used theTestInfoExtensionto log when a test starts. However, for this to work, you either had to manually add the extension to your test class or extend AbstractTest. Otherwise there would have been no output.CloseIntroExtensionis now a regular Extension which just makes sure the Intro is closed. This has the same advantage, that you don't have to use it explicitly or inherit from AbstractTestLoggingTestExecutionListeneris now used to report when a test case or test container starts/finish. This implementsTestExecutionListenerwhich has the advantage that it is called for each test, even for skipped ones and that you also get access to the result of the test case execution, which is something you cannot do with something like beforeEach/afterEach.LoggingLauncherSessionListeneris now used to redirect stderr and configure the java.util.logging. This implementsLauncherSessionListenerwhich is only called once per test session, instead of previously being done before each test case.