microsoft / microsoft/vscode-java-test

Test Runner for Java ignores @Order annotations on test classes

Đang mở
#1,748 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

ai-triaged bug gradle high-priority junit test-execution
Ngôn ngữ chính
TypeScript
Star
340
Fork
173
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
18

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với luồng thực thi của chế độ xem VSCode Testing và so sánh với lần chạy kiểm thử Gradle, sử dụng các issue liên quan #1740 và #1756 làm ngữ cảnh. Xác minh xem hành vi của @Order và @EnabledIf ở cấp lớp có được giữ nguyên hay không; được xem là hoàn tất khi các lớp và phương thức có thứ tự được chạy nhất quán, hoặc khi việc ghi đè phiên bản runner được hỗ trợ được ghi lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, typescript, vscode
Lĩnh vực
devtools, testing-qa
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.