Skip to content

Commit d3365e5

Browse files
wenytang-msCopilot
andcommitted
feat: add E2E autotest plans and GitHub Action workflow
Add 16 YAML test plans covering all wiki Test-Plan.md scenarios: - Basic editing (#1-9): snippets, code actions, imports, rename, new file - Maven / Maven Multimodule / Gradle projects - JDK 25 compatibility (Maven + Gradle) - Single file / Single file without workspace - Debugger, Test Runner, Dependency Viewer - Maven for Java (Resolve Unknown Type) - Java Extension Pack (Configure Classpath) - Fresh Import (Spring Petclinic, auto-clone) GitHub Action (manual trigger): - Runs all test plans on windows-latest - Uploads test-results/ (screenshots + JSON) as artifact - Supports running a single plan via workflow_dispatch input Uses @vscjava/vscode-autotest CLI for execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a848ef1 commit d3365e5

17 files changed

Lines changed: 332 additions & 409 deletions

.github/workflows/e2e-autotest.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ on:
88
required: false
99
default: ""
1010
type: string
11+
vscode_version:
12+
description: "VSCode version"
13+
required: false
14+
default: "stable"
15+
type: choice
16+
options:
17+
- stable
18+
- insiders
1119

1220
jobs:
1321
e2e-test:
@@ -17,20 +25,18 @@ jobs:
1725
steps:
1826
- name: Checkout vscode-java-pack
1927
uses: actions/checkout@v4
20-
with:
21-
path: vscode-java-pack
2228

23-
- name: Checkout vscode-java (test projects)
29+
- name: Checkout vscode-java
2430
uses: actions/checkout@v4
2531
with:
2632
repository: redhat-developer/vscode-java
27-
path: vscode-java
33+
path: ../vscode-java
2834

29-
- name: Checkout eclipse.jdt.ls (Gradle test projects)
35+
- name: Checkout eclipse.jdt.ls
3036
uses: actions/checkout@v4
3137
with:
3238
repository: eclipse-jdtls/eclipse.jdt.ls
33-
path: eclipse.jdt.ls
39+
path: ../eclipse.jdt.ls
3440

3541
- name: Setup Node.js
3642
uses: actions/setup-node@v4
@@ -48,7 +54,6 @@ jobs:
4854

4955
- name: Run test plan(s)
5056
shell: pwsh
51-
working-directory: vscode-java-pack
5257
run: |
5358
$plan = "${{ inputs.test_plan }}"
5459
if ($plan -and $plan -ne "") {
@@ -65,10 +70,8 @@ jobs:
6570
autotest run "test-plans/$($p.Name)"
6671
if ($LASTEXITCODE -ne 0) { $failed += $p.Name }
6772
}
68-
Write-Host "`n========== Summary =========="
69-
Write-Host "Total: $($plans.Count) Failed: $($failed.Count)"
7073
if ($failed.Count -gt 0) {
71-
Write-Host "Failed: $($failed -join ', ')"
74+
Write-Host "`n❌ Failed plans: $($failed -join ', ')"
7275
exit 1
7376
}
7477
}
@@ -77,6 +80,6 @@ jobs:
7780
if: always()
7881
uses: actions/upload-artifact@v4
7982
with:
80-
name: e2e-test-results
81-
path: vscode-java-pack/test-results/
83+
name: test-results
84+
path: test-results/
8285
retention-days: 30

test-plans/java-basic-editing.yaml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11
# Test Plan: Java Basic Editing (from vscode-java-pack.wiki)
22
#
3-
# Source: wiki Test-Plan.md "Basic" scenario (Steps 1-5)
4-
# Verify: Open Eclipse projectLanguage Server ready → Code snippet → Code Action fixes error
3+
# 来源: wiki Test-Plan.md "Basic" 场景 (Steps 1-5)
4+
# 验证: 打开 Eclipse 项目语言服务器就绪 → 代码片段 → Code Action 修复错误
55
#
6-
# Prerequisites:
7-
# - vscode-java repository cloned locally
8-
# - JDK installed and available
6+
# 前置条件:
7+
# - vscode-java 仓库已 clone 到本地
8+
# - JDK 已安装且可用
99
#
10-
# Usage: autotest run test-plans/java-basic-editing.yaml
10+
# 用法: autotest run test-plans/java-basic-editing.yaml
1111

12-
name: "Java Basic Editing — Diagnostics, Code Snippets, Code Action"
12+
name: "Java Basic Editing — 诊断、代码片段、Code Action"
1313
description: |
14-
Corresponds to the first 5 steps of the Basic scenario in the wiki Test Plan:
15-
Open the simple-app Eclipse project, verify Language Server starts up,
16-
use class code snippet to fix Foo.java, add missing method via Code Action,
17-
ultimately no compilation errors.
14+
对应 wiki Test Plan 的 Basic 场景前 5 步:
15+
打开 simple-app Eclipse 项目,验证语言服务器启动,
16+
使用 class 代码片段修复 Foo.java,通过 Code Action 补全缺失方法,
17+
最终编译无错误。
1818
1919
setup:
2020
extension: "redhat.java"
2121
extensions:
2222
- "vscjava.vscode-java-pack"
23-
# To test extension dev version, uncomment:
23+
# 如果需要测试扩展开发版本,取消注释:
2424
# extensionPath: "../../vscode-java"
2525
vscodeVersion: "stable"
2626
workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app"
27-
timeout: 60 # Java LS starts slowly, needs sufficient wait time
27+
timeout: 60 # Java LS 启动较慢,需要足够等待时间
2828

2929
steps:
30-
# ── Step 1: Open project ──────────────────────────────────
30+
# ── Step 1: 打开项目 ──────────────────────────────────────
3131
- id: "project-loaded"
32-
action: "wait 5 seconds"
33-
verify: "Project file tree is visible"
32+
action: "等待 5 "
33+
verify: "项目文件树可见"
3434

35-
# ── Step 2: Language Server ready + diagnostics ──────────
35+
# ── Step 2: 语言服务器就绪 + 诊断 ────────────────────────
3636
# wiki: "After the language server is initialized, check the status bar
3737
# icon is 👍, and the problems view has two errors."
3838
- id: "ls-ready"
3939
action: "waitForLanguageServer"
40-
verify: "Status bar shows Java Language Server is ready (👍 icon)"
40+
verify: "状态栏显示 Java 语言服务器已就绪(👍 图标)"
4141
verifyProblems:
4242
errors: 2
4343
timeout: 120
4444

45-
# ── Step 3: Fix Foo.java (write class skeleton) ─────────────
45+
# ── Step 3: 修复 Foo.java(写入 class 代码骨架)────────────
4646
# wiki: "Select Foo.java file, invoke `class` code snippet to generate code
4747
# and the problem view error number is reduced to 1."
48-
# Note: Foo.java is an empty file, using disk modification to write class skeleton (snippet is unstable in empty files)
48+
# 注意: Foo.java 是空文件,使用磁盘修改写入 class 骨架(snippet 在空文件中不稳定)
4949
- id: "open-foo"
50-
action: "open file Foo.java"
51-
verify: "Foo.java file is opened in the editor"
50+
action: "打开文件 Foo.java"
51+
verify: "Foo.java 文件已在编辑器中打开"
5252
timeout: 15
5353

5454
- id: "write-class-body"
@@ -59,20 +59,20 @@ steps:
5959
errors: 1
6060
timeout: 30
6161

62-
# ── Step 4: Create missing method call() ─────────────────
62+
# ── Step 4: 创建缺失方法 call() ──────────────────────────
6363
# wiki: "Select 'Create method call() in type Foo' to fix the error."
64-
# Directly add call() method via disk modification (Code Action is unstable in automation)
64+
# 直接通过磁盘修改添加 call() 方法(Code Action 在自动化中不稳定)
6565
- id: "add-call-method"
6666
action: "insertLineInFile src/app/Foo.java 4 public void call() {}\n"
6767
verifyProblems:
6868
errors: 0
6969
timeout: 30
7070

71-
# ── Step 5: Save and verify no errors ────────────────────
71+
# ── Step 5: 保存并验证无错误 ─────────────────────────────
7272
# wiki: "Save all the files... There should be no errors."
7373
- id: "save-all"
74-
action: "run command File: Save All"
75-
verify: "All files saved, no compilation errors"
74+
action: "执行命令 File: Save All"
75+
verify: "所有文件已保存,编译无错误"
7676
verifyProblems:
7777
errors: 0
7878
timeout: 30

test-plans/java-basic-extended.yaml

Lines changed: 0 additions & 80 deletions
This file was deleted.

test-plans/java-debugger.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Test Plan: Debugger for Java (from vscode-java-pack.wiki)
22
#
3-
# Source: wiki Test-Plan.md "Debugger for Java" scenario
4-
# Verify: Start debugging → Breakpoint hit → Step through → Variable inspection → Program output
3+
# 来源: wiki Test-Plan.md "Debugger for Java" 场景
4+
# 验证: 启动调试 → 断点命中 → 单步调试 → 变量查看 → 程序输出
55
#
6-
# Uses simple-app project (App.java with main method)
6+
# 使用 simple-app 项目(有 main 方法的 App.java
77
#
8-
# Prerequisites:
9-
# - vscode-java repository cloned locally
10-
# - JDK installed and available
8+
# 前置条件:
9+
# - vscode-java 仓库已 clone 到本地
10+
# - JDK 已安装且可用
1111
#
12-
# Usage: autotest run test-plans/java-debugger.yaml
12+
# 用法: autotest run test-plans/java-debugger.yaml
1313

14-
name: "Java Debugger — Breakpoint Debugging"
14+
name: "Java Debugger — 断点调试"
1515
description: |
16-
Corresponds to the Debugger for Java scenario in the wiki Test Plan:
17-
Open the simple-app project, set breakpoints, start debugging,
18-
verify breakpoint hit and program output.
16+
对应 wiki Test Plan 的 Debugger for Java 场景:
17+
打开 simple-app 项目,设置断点,启动调试,
18+
验证断点命中和程序输出。
1919
2020
setup:
2121
extension: "redhat.java"
@@ -26,38 +26,38 @@ setup:
2626
timeout: 60
2727

2828
steps:
29-
# ── Wait for LS ready ───────────────────────────────────────
29+
# ── 等待 LS 就绪 ─────────────────────────────────────────
3030
- id: "ls-ready"
3131
action: "waitForLanguageServer"
32-
verify: "Status bar shows Java Language Server is ready"
32+
verify: "状态栏显示 Java 语言服务器已就绪"
3333
timeout: 120
3434

35-
# ── Open App.java ──────────────────────────────────────────
35+
# ── 打开 App.java ────────────────────────────────────────
3636
- id: "open-app"
37-
action: "open file App.java"
38-
verify: "App.java file is opened in the editor"
37+
action: "打开文件 App.java"
38+
verify: "App.java 文件已在编辑器中打开"
3939
timeout: 15
4040

41-
# ── Set breakpoint ──────────────────────────────────────────
41+
# ── 设置断点 ─────────────────────────────────────────────
4242
# wiki: "verify if the breakpoint is hit"
43-
# App.java line 5 is System.out.println("Hello Java");
43+
# App.java 5 行是 System.out.println("Hello Java");
4444
- id: "set-breakpoint"
4545
action: "setBreakpoint 5"
46-
verify: "Breakpoint set on line 5"
46+
verify: "在第 5 行设置了断点"
4747

48-
# ── Start debugging ────────────────────────────────────────
48+
# ── 启动调试 ─────────────────────────────────────────────
4949
- id: "start-debug"
5050
action: "startDebugSession"
51-
verify: "Debug session started, debug toolbar is visible"
51+
verify: "调试会话已启动,调试工具栏可见"
5252
timeout: 30
5353

54-
# ── Verify debug console output ──────────────────────────────
54+
# ── 验证调试控制台输出 ────────────────────────────────────
5555
# wiki: "program output is as expected"
5656
- id: "wait-for-output"
57-
action: "wait 5 seconds"
58-
verify: "Program runs and produces output"
57+
action: "等待 5 "
58+
verify: "程序运行并输出结果"
5959

60-
# ── Stop debugging ─────────────────────────────────────────
60+
# ── 停止调试 ─────────────────────────────────────────────
6161
- id: "stop-debug"
6262
action: "stopDebugSession"
63-
verify: "Debug session stopped"
63+
verify: "调试会话已停止"

0 commit comments

Comments
 (0)