microsoft / microsoft/vscode-java-test

Test Runner for Java ignores @Order annotations on test classes

Abierto
#1,748 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

ai-triaged bug gradle high-priority junit test-execution
Lenguaje dominante
TypeScript
Estrellas
340
Forks
173
Merge medio
1 d 19 h
PR fusionados (30 d)
18

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la ruta de ejecución de la vista VSCode Testing y compárala con la ejecución de pruebas de Gradle, usando los issues relacionados #1740 y #1756 como contexto. Verifica si se conserva el comportamiento de @Order y @EnabledIf a nivel de clase; se considera completado cuando las clases y los métodos ordenados se ejecutan de forma consistente, o cuando se documenta la sobrescritura de la versión del runner compatible.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, typescript, vscode
Área
devtools, testing-qa
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.