You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test Runner for Java ignores @Order annotations on test classes #1748
Symptom: JUnit 5 test classes which reliably run in the correct order with gradlew test run in the wrong order in the VSCode IDE.
System: Windows 10, VSCode 1.96.3, Gradle 8.12, Spring Boot 3.4.1, Java 21.04, JUnit 5.11.4
Use case: In a Spring Boot client-server Gradle project, the integration tests in the client execute against the running server. The server-side database state built up by earlier integration tests is required by the later integration tests and thus the tests must be executed in a specific order. Accordingly, the test classes and methods are annotated with @Order and the configuration property junit.jupiter.testclass.order.default = org.junit.jupiter.api.ClassOrderer$OrderAnnotation is set. Executed under Gradle the test classes and methods all run in the designated order. However, in the VSCode Testing view contributed by this extension, the test classes get executed in the wrong order and some test methods don't run at all because they use the @EnabledIf annotation to check whether requisite client-side state (reflecting server-side state) has been collected by tests that are supposed to have run already but which in fact haven't yet run.
I've scoured the docs, searched the web and asked several AI chatbots about this but haven't found any solutions that work.
Hypothesis: the test runner is embedded in the extension (v. 0.43.0) and is of too early a version to support test class ordering (~JUnit 5.8, I believe).
Is it possible to override the test runner version?
Hi Adrian Price (@demonfiddler), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
The Java Test Runner in VS Code bundles its own JUnit Platform (currently ~5.8.x) and does not expose a setting to override the embedded runner version. As a result, Erik Zawadzki (@order) on test classes isn’t honored by the extension’s test executor even though Gradle uses your configured 5.11.4 platform.
Suggestions:
Use a JUnit Platform Suite to enforce ordering explicitly:
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
Activity
github-actions commentedon Nov 12, 2025
Hi Adrian Price (@demonfiddler), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
The Java Test Runner in VS Code bundles its own JUnit Platform (currently ~5.8.x) and does not expose a setting to override the embedded runner version. As a result, Erik Zawadzki (@order) on test classes isn’t honored by the extension’s test executor even though Gradle uses your configured 5.11.4 platform.
Suggestions:
Use a JUnit Platform Suite to enforce ordering explicitly:
Running the
IntegrationTestSuitewill honor the declared order in VS Code’s Test Explorer.As a simpler workaround, prefix your test class names (or folders) with numbers (
01_InitTests,02_StateTests, …) to force lexical ordering.Track/support for Erik Zawadzki (@order) in the extension:
JUnit 5.10+ is required to run tests #1740
Test Runner for Java ignores @BeforeAll annotations on test classes #1756
Other references with low confidence
The runner are runnig tests methods with @Ignore tags #201
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!