microsoft / microsoft/vscode-java-test

Test Runner for Java ignores @Order annotations on test classes

Offen
#1,748 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

ai-triaged bug gradle high-priority junit test-execution
Vorherrschende Sprache
TypeScript
Sterne
340
Forks
173
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
18

Beschreibung

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?

Related issues: https://github.com/microsoft/vscode-java-test/issues/1740, #1756

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Ausführungspfad der VSCode Testing-Ansicht und vergleiche ihn mit dem Gradle-Testlauf, wobei die verwandten Issues #1740 und #1756 als Kontext dienen. Überprüfe, ob das Verhalten von @Order und @EnabledIf auf Klassenebene erhalten bleibt; abgeschlossen ist die Aufgabe, wenn geordnete Klassen und Methoden konsistent ausgeführt werden oder das unterstützte Überschreiben der Runner-Version dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, typescript, vscode
Bereich
devtools, testing-qa
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.