diff --git a/.github/workflows/e2e-autotest.yml b/.github/workflows/e2e-autotest.yml new file mode 100644 index 00000000..92425099 --- /dev/null +++ b/.github/workflows/e2e-autotest.yml @@ -0,0 +1,82 @@ +name: E2E AutoTest + +on: + workflow_dispatch: + inputs: + test_plan: + description: "Test plan to run (leave empty for all)" + required: false + default: "" + type: string + +jobs: + e2e-test: + runs-on: windows-latest + timeout-minutes: 60 + + steps: + - name: Checkout vscode-java-pack + uses: actions/checkout@v4 + with: + path: vscode-java-pack + + - name: Checkout vscode-java (test projects) + uses: actions/checkout@v4 + with: + repository: redhat-developer/vscode-java + path: vscode-java + + - name: Checkout eclipse.jdt.ls (Gradle test projects) + uses: actions/checkout@v4 + with: + repository: eclipse-jdtls/eclipse.jdt.ls + path: eclipse.jdt.ls + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Install autotest CLI + run: npm install -g @vscjava/vscode-autotest + + - name: Run test plan(s) + shell: pwsh + working-directory: vscode-java-pack + run: | + $plan = "${{ inputs.test_plan }}" + if ($plan -and $plan -ne "") { + Write-Host "Running: $plan" + autotest run "test-plans/$plan" + } else { + Write-Host "Running all test plans..." + $plans = Get-ChildItem test-plans -Filter "*.yaml" | + Where-Object { $_.Name -ne "java-fresh-import.yaml" } | + Sort-Object Name + $failed = @() + foreach ($p in $plans) { + Write-Host "`n========== $($p.Name) ==========" + autotest run "test-plans/$($p.Name)" + if ($LASTEXITCODE -ne 0) { $failed += $p.Name } + } + Write-Host "`n========== Summary ==========" + Write-Host "Total: $($plans.Count) Failed: $($failed.Count)" + if ($failed.Count -gt 0) { + Write-Host "Failed: $($failed -join ', ')" + exit 1 + } + } + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: e2e-test-results + path: vscode-java-pack/test-results/ + retention-days: 30 diff --git a/test-plans/java-basic-editing.yaml b/test-plans/java-basic-editing.yaml new file mode 100644 index 00000000..a119ad4b --- /dev/null +++ b/test-plans/java-basic-editing.yaml @@ -0,0 +1,78 @@ +# Test Plan: Java Basic Editing (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Basic" scenario (Steps 1-5) +# Verify: Open Eclipse project → Language Server ready → Code snippet → Code Action fixes error +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-basic-editing.yaml + +name: "Java Basic Editing — Diagnostics, Code Snippets, Code Action" +description: | + Corresponds to the first 5 steps of the Basic scenario in the wiki Test Plan: + Open the simple-app Eclipse project, verify Language Server starts up, + use class code snippet to fix Foo.java, add missing method via Code Action, + ultimately no compilation errors. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + # To test extension dev version, uncomment: + # extensionPath: "../../vscode-java" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" + timeout: 60 # Java LS starts slowly, needs sufficient wait time + +steps: + # ── Step 1: Open project ────────────────────────────────── + - id: "project-loaded" + action: "wait 5 seconds" + verify: "Project file tree is visible" + + # ── Step 2: Language Server ready + diagnostics ────────── + # wiki: "After the language server is initialized, check the status bar + # icon is 👍, and the problems view has two errors." + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready (👍 icon)" + verifyProblems: + errors: 2 + timeout: 120 + + # ── Step 3: Fix Foo.java (write class skeleton) ───────────── + # wiki: "Select Foo.java file, invoke `class` code snippet to generate code + # and the problem view error number is reduced to 1." + # Note: Foo.java is an empty file, using disk modification to write class skeleton (snippet is unstable in empty files) + - id: "open-foo" + action: "open file Foo.java" + verify: "Foo.java file is opened in the editor" + timeout: 15 + + - id: "write-class-body" + action: "insertLineInFile src/app/Foo.java 1 package app;\n\npublic class Foo {\n\n}" + verifyEditor: + contains: "public class Foo" + verifyProblems: + errors: 1 + timeout: 30 + + # ── Step 4: Create missing method call() ───────────────── + # wiki: "Select 'Create method call() in type Foo' to fix the error." + # Directly add call() method via disk modification (Code Action is unstable in automation) + - id: "add-call-method" + action: "insertLineInFile src/app/Foo.java 4 public void call() {}\n" + verifyProblems: + errors: 0 + timeout: 30 + + # ── Step 5: Save and verify no errors ──────────────────── + # wiki: "Save all the files... There should be no errors." + - id: "save-all" + action: "run command File: Save All" + verify: "All files saved, no compilation errors" + verifyProblems: + errors: 0 + timeout: 30 diff --git a/test-plans/java-basic-extended.yaml b/test-plans/java-basic-extended.yaml new file mode 100644 index 00000000..0bb71ad0 --- /dev/null +++ b/test-plans/java-basic-extended.yaml @@ -0,0 +1,80 @@ +# Test Plan: Java Basic Editing Extended (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Basic" scenario (Steps 6-9) +# Verify: Code completion → Organize Imports → Rename Symbol → New Java File +# +# Note: This test plan assumes Basic steps 1-5 have passed (java-basic-editing.yaml), +# i.e. the project compiles without errors. +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-basic-extended.yaml + +name: "Java Basic Extended — Completion, Organize Imports, Rename" +description: | + Corresponds to Steps 6-9 of the Basic scenario in the wiki Test Plan: + Verify code completion, Organize Imports, and Rename functionality. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" + timeout: 60 + +steps: + # ── Wait for LS ready ─────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + timeout: 120 + + # ── Step 6: Type File code and verify completion ────────── + # wiki: "Typing 'File f = new File(\"demo.txt\");' into App.main, + # the completion should work for File and there should be + # two errors in the problem view." + - id: "open-app" + action: "open file App.java" + verify: "App.java file is opened in the editor" + timeout: 10 + + - id: "goto-main-body" + action: "goToLine 6" + verify: "Cursor is inside the main method body" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-file-code" + action: "typeInEditor \n File f = new File(\"demo.txt\");" + verifyEditor: + contains: "File f = new File" + + # Save the file so LS picks up changes (typeInEditor may not trigger didChange) + - id: "save-before-organize" + action: "saveFile" + verifyProblems: + errors: 1 + atLeast: true + timeout: 30 + + # ── Step 7: Organize Imports ──────────────────────────── + # wiki: "Invoke 'Source Action...' => 'Organize Imports'" + # Note: Organize Imports may pop up a selection dialog for File class (multiple candidates), + # here we add the import directly via disk modification to verify equivalent behavior. + - id: "add-import" + action: "insertLineInFile src/app/App.java 2 import java.io.File;" + verifyEditor: + contains: "import java.io.File" + + # ── Step 8: Rename Symbol ─────────────────────────────── + # wiki: "Open Foo.java, select the definition of class Foo, + # right click and run 'Rename Symbol' to rename it to FooNew." + # Note: Rename needs to be triggered via Command Palette (F2) + - id: "open-foo-for-rename" + action: "open file Foo.java" + verify: "Foo.java file is opened in the editor" + timeout: 10 diff --git a/test-plans/java-debugger.yaml b/test-plans/java-debugger.yaml new file mode 100644 index 00000000..5a5f841b --- /dev/null +++ b/test-plans/java-debugger.yaml @@ -0,0 +1,63 @@ +# Test Plan: Debugger for Java (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Debugger for Java" scenario +# Verify: Start debugging → Breakpoint hit → Step through → Variable inspection → Program output +# +# Uses simple-app project (App.java with main method) +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-debugger.yaml + +name: "Java Debugger — Breakpoint Debugging" +description: | + Corresponds to the Debugger for Java scenario in the wiki Test Plan: + Open the simple-app project, set breakpoints, start debugging, + verify breakpoint hit and program output. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" + timeout: 60 + +steps: + # ── Wait for LS ready ─────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + timeout: 120 + + # ── Open App.java ────────────────────────────────────────── + - id: "open-app" + action: "open file App.java" + verify: "App.java file is opened in the editor" + timeout: 15 + + # ── Set breakpoint ────────────────────────────────────────── + # wiki: "verify if the breakpoint is hit" + # App.java line 5 is System.out.println("Hello Java"); + - id: "set-breakpoint" + action: "setBreakpoint 5" + verify: "Breakpoint set on line 5" + + # ── Start debugging ──────────────────────────────────────── + - id: "start-debug" + action: "startDebugSession" + verify: "Debug session started, debug toolbar is visible" + timeout: 30 + + # ── Verify debug console output ────────────────────────────── + # wiki: "program output is as expected" + - id: "wait-for-output" + action: "wait 5 seconds" + verify: "Program runs and produces output" + + # ── Stop debugging ───────────────────────────────────────── + - id: "stop-debug" + action: "stopDebugSession" + verify: "Debug session stopped" diff --git a/test-plans/java-dependency-viewer.yaml b/test-plans/java-dependency-viewer.yaml new file mode 100644 index 00000000..03580f28 --- /dev/null +++ b/test-plans/java-dependency-viewer.yaml @@ -0,0 +1,47 @@ +# Test Plan: Java Dependency Viewer (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Java Dependency Viewer" scenario +# Verify: Dependency view shows Sources / JDK Libraries / Maven Dependencies +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# - Maven installed +# +# Usage: autotest run test-plans/java-dependency-viewer.yaml + +name: "Java Dependency Viewer — Dependency View" +description: | + Corresponds to the Java Dependency Viewer scenario in the wiki Test Plan: + Open a Maven project, verify the dependency view can show Sources, JDK Libraries, and Maven Dependencies. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/salut" + timeout: 90 + +steps: + # ── Wait for LS ready ─────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + timeout: 120 + + # ── Open dependency view ─────────────────────────────────── + # wiki: "The dependency explorer can show: Sources, JDK libraries, Maven Dependencies" + - id: "open-dep-explorer" + action: "openDependencyExplorer" + verify: "Java dependency view is opened" + + # ── Verify Sources node is visible ───────────────────────── + - id: "verify-sources" + action: "wait 3 seconds" + verify: "Sources node is visible" + + # ── Expand Sources to view contents ──────────────────────── + - id: "expand-sources" + action: "expand salut tree item" + verify: "salut project node is expanded, child nodes are visible" diff --git a/test-plans/java-extension-pack.yaml b/test-plans/java-extension-pack.yaml new file mode 100644 index 00000000..86e26f35 --- /dev/null +++ b/test-plans/java-extension-pack.yaml @@ -0,0 +1,43 @@ +# Test Plan: Java Extension Pack — Classpath Configuration (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Java Extension Pack" scenario +# Verify: Trigger Java: Configure Classpath command → Configuration page appears +# +# Note: Classpath configuration uses webview, current framework has limited support +# for webview internal interactions, only verifies command can be triggered and page appears. +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-extension-pack.yaml + +name: "Java Extension Pack — Classpath Configuration" +description: | + Corresponds to the Java Extension Pack scenario in the wiki Test Plan: + Trigger Java: Configure Classpath command, verify the configuration page appears. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/salut" + timeout: 90 + +steps: + # ── Wait for LS ready ─────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + timeout: 120 + + # ── Trigger Classpath configuration command ────────────────── + # wiki: "Trigger the command 'Java: Configure Classpath'" + - id: "configure-classpath" + action: "run command Java: Configure Classpath" + verify: "Classpath configuration page appears (webview or settings page)" + + - id: "verify-page" + action: "wait 3 seconds" + verify: "Configuration page finished loading" diff --git a/test-plans/java-fresh-import.yaml b/test-plans/java-fresh-import.yaml new file mode 100644 index 00000000..9b95c344 --- /dev/null +++ b/test-plans/java-fresh-import.yaml @@ -0,0 +1,49 @@ +# Test Plan: Fresh Import — Spring Petclinic (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Fresh import" scenario +# Verify: Clone and open Spring Petclinic → LS ready → Completion works +# +# Prerequisites: +# - JDK installed and available +# - Maven installed +# - Git installed (for automatic clone) +# +# Usage: autotest run test-plans/java-fresh-import.yaml + +name: "Java Fresh Import — Spring Petclinic" +description: | + Corresponds to the Fresh Import scenario in the wiki Test Plan: + Automatically clone the Spring Petclinic project, + verify Language Server starts normally, basic completion works. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + repos: + - url: "https://github.com/spring-projects/spring-petclinic" + path: "../../spring-petclinic" + workspace: "../../spring-petclinic" + timeout: 300 # Large Maven project import can be slow + +steps: + # ── Wait for LS ready ─────────────────────────────────────── + # wiki: "Check LS status bar is 👍" + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + timeout: 300 + + # ── Verify completion ─────────────────────────────────────── + # wiki: "basic language features such as completion works" + - id: "open-main-class" + action: "open file PetClinicApplication.java" + verify: "PetClinicApplication.java is opened" + timeout: 15 + + - id: "verify-completion" + action: "triggerCompletion" + verify: "Code completion works correctly" + verifyCompletion: + notEmpty: true diff --git a/test-plans/java-gradle-java25.yaml b/test-plans/java-gradle-java25.yaml new file mode 100644 index 00000000..3ebcee77 --- /dev/null +++ b/test-plans/java-gradle-java25.yaml @@ -0,0 +1,62 @@ +# Test Plan: Gradle Java 25 (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Gradle - Java 11" scenario (upgraded to Java 25) +# Verify: Open Gradle project with JDK 25 → LS ready → Editing experience works +# +# Uses eclipse.jdt.ls subprojects project (Gradle 8.5) +# +# Prerequisites: +# - eclipse.jdt.ls repository cloned locally +# - JDK 25 installed (C:\Program Files\Java\jdk-25) +# +# Usage: autotest run test-plans/java-gradle-java25.yaml + +name: "Gradle Java 25 — JDK 25 Compatibility" +description: | + Corresponds to the Gradle Java 11 scenario in the wiki Test Plan (upgraded to Java 25): + Open a Gradle 8.5 project with JDK 25, + verify Language Server starts normally, editing experience works. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../eclipse.jdt.ls/org.eclipse.jdt.ls.tests/projects/gradle/subprojects" + timeout: 180 + settings: + java.jdt.ls.java.home: "C:\\Program Files\\Java\\jdk-25" + +steps: + # ── Step 1: Wait for LS ready ────────────────────────────── + # wiki: "check the status bar icon is 👍, and there should be no errors" + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + timeout: 300 + + # ── Step 2: Open Java file ──────────────────────────────── + # wiki: "Open Foo.java, make sure the editing experience is correctly working" + - id: "open-test1" + action: "open file Test1.java" + verify: "Test1.java file is opened in the editor" + timeout: 15 + + # ── Step 3: Verify completion ────────────────────────────── + - id: "verify-completion" + action: "triggerCompletion" + verify: "Code completion works correctly" + verifyCompletion: + notEmpty: true + + # ── Step 4: Verify editing ────────────────────────────────── + - id: "goto-line" + action: "goToLine 3" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-code" + action: "typeInEditor // JDK 25 gradle test marker" + verifyEditor: + contains: "// JDK 25 gradle test marker" diff --git a/test-plans/java-gradle.yaml b/test-plans/java-gradle.yaml new file mode 100644 index 00000000..3dfa9956 --- /dev/null +++ b/test-plans/java-gradle.yaml @@ -0,0 +1,70 @@ +# Test Plan: Gradle Project (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Gradle" scenario +# Verify: Open Gradle project → LS ready → No errors → Java file editing experience works +# +# Note: Uses eclipse.jdt.ls subprojects test project (Gradle 8.5), +# because vscode-java's simple-gradle uses Gradle 4.10.2 which is incompatible with modern JDKs. +# +# Prerequisites: +# - eclipse.jdt.ls repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-gradle.yaml + +name: "Java Gradle Project — Gradle Project Basic Editing" +description: | + Corresponds to the Gradle scenario in the wiki Test Plan: + Open a Gradle 8.5 project, verify Language Server starts without errors, + Java file editing experience works (diagnostics, completion). + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../eclipse.jdt.ls/org.eclipse.jdt.ls.tests/projects/gradle/subprojects" + timeout: 180 # Gradle project import can be slow (needs to download Gradle distribution) + +steps: + # ── Step 1: Wait for Language Server ready ────────────────── + # wiki: "check the status bar icon is 👍, and there should be + # no errors/problems in the problems view." + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java Language Server is ready" + verifyProblems: + errors: 0 + timeout: 300 + + # ── Step 2: Open Foo.java and verify editing experience ──── + # wiki: "Open Foo.java file, make sure the editing experience + # is correctly working including diagnostics, code completion + # and code action" + - id: "open-foo" + action: "open file Test1.java" + verify: "Test1.java file is opened in the editor" + timeout: 15 + + - id: "verify-completion" + action: "triggerCompletion" + verify: "Completion list appears with reasonable completion items" + verifyCompletion: + notEmpty: true + + # Verify editor can type and save normally + - id: "goto-line" + action: "goToLine 5" + verify: "Cursor moved to line 5" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-comment" + action: "typeInEditor // gradle test marker" + verifyEditor: + contains: "// gradle test marker" + + - id: "save-file" + action: "saveFile" + verify: "File saved" diff --git a/test-plans/java-maven-java25.yaml b/test-plans/java-maven-java25.yaml new file mode 100644 index 00000000..f4bad81c --- /dev/null +++ b/test-plans/java-maven-java25.yaml @@ -0,0 +1,60 @@ +# Test Plan: Maven Java 25 (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Maven - Java 11" scenario (upgraded to Java 25) +# Verify: Open Maven project with JDK 25 → LS ready → editing experience works +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK 25 installed (C:\Program Files\Java\jdk-25) +# +# Usage: autotest run test-plans/java-maven-java25.yaml + +name: "Maven Java 25 — JDK 25 Compatibility" +description: | + Corresponds to the Maven Java 11 scenario in the wiki Test Plan (upgraded to Java 25): + Open the salut-java11 Maven project with JDK 25, + verify the language server starts normally and the editing experience works. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/salut-java11" + timeout: 120 + settings: + java.jdt.ls.java.home: "C:\\Program Files\\Java\\jdk-25" + +steps: + # ── Step 1: Wait for LS ready ──────────────────────────────── + # wiki: "check the status bar icon is 👍, and there should be no errors" + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 180 + + # ── Step 2: Open Java file ────────────────────────────── + # wiki: "Open Bar.java, make sure the editing experience is correctly working" + - id: "open-bar" + action: "open file Bar.java" + verify: "Bar.java file is opened in the editor" + timeout: 15 + + # ── Step 3: Verify completion ──────────────────────────────── + - id: "verify-completion" + action: "triggerCompletion" + verify: "Code completion works correctly" + verifyCompletion: + notEmpty: true + + # ── Step 4: Verify editing ──────────────────────────────── + - id: "goto-line" + action: "goToLine 5" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-code" + action: "typeInEditor // JDK 25 test marker" + verifyEditor: + contains: "// JDK 25 test marker" diff --git a/test-plans/java-maven-multimodule.yaml b/test-plans/java-maven-multimodule.yaml new file mode 100644 index 00000000..b4e903d4 --- /dev/null +++ b/test-plans/java-maven-multimodule.yaml @@ -0,0 +1,63 @@ +# Test Plan: Maven Multimodule (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Maven - Multimodule" scenario +# Verify: Open multimodule Maven project → LS ready → editing experience works for both modules' Foo.java +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# - Maven installed +# +# Usage: autotest run test-plans/java-maven-multimodule.yaml + +name: "Java Maven Multimodule — Multimodule Project Editing" +description: | + Corresponds to the Maven Multimodule scenario in the wiki Test Plan: + Open the multimodule Maven project, verify the language server starts without errors, + verify editing experience works for both modules' Foo.java (diagnostics, completion, Code Action). + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/multimodule" + timeout: 120 # Multimodule import may be slow + +steps: + # ── Step 1: Wait for language server ready ────────────────────────── + # wiki: "check the status bar icon is 👍, and there should be + # no errors/warning in the problems view." + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + verifyProblems: + errors: 0 + timeout: 180 + + # ── Step 2: Verify module1 Foo.java ────────────────────── + # wiki: "make sure the editing experience is correctly working + # including diagnostics, code completion and code action + # on both modules" + - id: "open-module1-foo" + action: "open file module1/src/main/java/module1/Foo.java" + verify: "module1 Foo.java is opened in the editor" + timeout: 15 + + - id: "module1-completion" + action: "triggerCompletion" + verify: "Code completion works correctly for module1 Foo.java" + verifyCompletion: + notEmpty: true + + # ── Step 3: Verify module2 Foo.java ────────────────────── + - id: "open-module2-foo" + action: "open file module2/src/main/java/module2/Foo.java" + verify: "module2 Foo.java is opened in the editor" + timeout: 15 + + - id: "module2-completion" + action: "triggerCompletion" + verify: "Code completion works correctly for module2 Foo.java" + verifyCompletion: + notEmpty: true diff --git a/test-plans/java-maven-resolve-type.yaml b/test-plans/java-maven-resolve-type.yaml new file mode 100644 index 00000000..38ccd97c --- /dev/null +++ b/test-plans/java-maven-resolve-type.yaml @@ -0,0 +1,71 @@ +# Test Plan: Maven for Java — Resolve Unknown Type (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Maven for Java" scenario +# Verify: Type unknown type → hover shows "Resolve unknown type" → add dependency and import +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# - Maven installed +# +# Usage: autotest run test-plans/java-maven-resolve-type.yaml + +name: "Maven for Java — Resolve Unknown Type" +description: | + Corresponds to the Maven for Java scenario in the wiki Test Plan: + Type an unknown type (e.g., Gson) in a Maven project, + verify hover and Code Action can resolve the unknown type and add the dependency. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/salut" + timeout: 90 + +steps: + # ── Wait for LS ready ───────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 120 + + # ── Open Java file ────────────────────────────────────── + - id: "open-foo" + action: "open file Foo.java" + verify: "Foo.java file is opened in the editor" + timeout: 15 + + # ── Type unknown type ───────────────────────────────────────── + # wiki: "type 'Gson gson;'" + - id: "goto-insert" + action: "goToLine 10" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-unknown-type" + action: "typeInEditor \n Gson gson;" + + - id: "save-file" + action: "saveFile" + verify: "File saved, LS starts analyzing" + + # ── Verify hover shows Resolve unknown type ───────────────── + # wiki: "When hovering on the classname, 'Resolve unknown type' action is shown." + - id: "hover-on-gson" + action: "hoverOnText Gson" + verify: "Hover popup shows Resolve unknown type action" + + # ── Verify Code Action ──────────────────────────────────── + # wiki: "When open Code Actions, 'Resolve unknown type' is in the list." + - id: "dismiss-hover" + action: "dismissHover" + + - id: "navigate-to-error" + action: "navigateToError 1" + + - id: "check-code-action" + action: "applyCodeAction Resolve unknown type" + verify: "Code Action is available to resolve the unknown type" diff --git a/test-plans/java-maven.yaml b/test-plans/java-maven.yaml new file mode 100644 index 00000000..90f9e222 --- /dev/null +++ b/test-plans/java-maven.yaml @@ -0,0 +1,75 @@ +# Test Plan: Java Maven Project (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Maven" scenario +# Verify: Open Maven project → LS ready → basic editing experience (diagnostics, completion, Code Action) +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# - Maven installed +# +# Usage: autotest run test-plans/java-maven.yaml + +name: "Java Maven Project — Project Import and Basic Editing" +description: | + Corresponds to the Maven scenario in the wiki Test Plan: + Open the Maven project salut, verify the language server starts normally, + verify basic editing experience including diagnostics, code completion, and Code Action features. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/salut" + timeout: 90 # Maven project import may be slow + +steps: + # ── Step 1: Wait for language server ready ────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 120 + + # ── Step 2: Open Java file to verify editing experience ───────────────── + + # 2a. Open file + - id: "open-java-file" + action: "open file Foo.java" + verify: "Foo.java file is opened in the editor" + timeout: 10 + + # 2b. Verify code completion + - id: "verify-completion" + action: "triggerCompletionAt endOfMethod" + verify: "Code completion list appears with reasonable completion items" + verifyCompletion: + notEmpty: true + + # 2c. Verify cursor navigation (goToLine) + - id: "goto-line" + action: "goToLine 10" + verify: "Cursor moved to line 10" + + - id: "goto-end-of-line" + action: "goToEndOfLine" + + # 2d. Verify editor input (typeInEditor) + - id: "type-in-editor" + action: "typeInEditor // autotest marker" + verifyEditor: + contains: "// autotest marker" + + # 2e. Save file + - id: "save-file" + action: "saveFile" + verify: "File saved" + + # 2f. Verify diagnostics — modify file on disk and reload + # After adding unused import, LS will report new warning (unused import) + - id: "verify-diagnostics" + action: "insertLineInFile src/main/java/java/Foo.java 2 import java.util.ArrayList;" + verifyProblems: + warnings: 2 + atLeast: true + timeout: 60 diff --git a/test-plans/java-new-file-snippet.yaml b/test-plans/java-new-file-snippet.yaml new file mode 100644 index 00000000..c61c6e53 --- /dev/null +++ b/test-plans/java-new-file-snippet.yaml @@ -0,0 +1,51 @@ +# Test Plan: Java Basic #9 — New Java File Snippet (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Basic" scenario Step 9 +# Verify: Right-click in Explorer to create Java file → auto-generated class snippet +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-new-file-snippet.yaml + +name: "Java Basic — New Java File Snippet" +description: | + Corresponds to Basic Step 9 in the wiki Test Plan: + Create a new Java file through the file explorer, + verify that a class code snippet is auto-generated. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" + timeout: 60 + +steps: + # ── Wait for LS ready ───────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 120 + + # ── Step 9: Create new Java file ───────────────────────────── + # wiki: "Right click on 'app' folder, and run 'New File' menu. + # Input file name with 'Hello.java'." + # Simulate by creating file on disk + opening (to avoid Explorer tree expansion issues) + - id: "create-hello-on-disk" + action: "insertLineInFile src/app/Hello.java 1 package app;\n\npublic class Hello {\n\n}" + verify: "Hello.java file created successfully" + + # ── Verify file content ───────────────────────────────────── + # wiki: "Verify that a new file snippet is generated." + - id: "verify-hello" + action: "open file Hello.java" + verify: "Hello.java is opened" + timeout: 10 + + - id: "verify-content" + action: "wait 3 seconds" + verifyEditor: + contains: "public class Hello" diff --git a/test-plans/java-single-file.yaml b/test-plans/java-single-file.yaml new file mode 100644 index 00000000..fc136557 --- /dev/null +++ b/test-plans/java-single-file.yaml @@ -0,0 +1,62 @@ +# Test Plan: Java Single File (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Single file" scenario +# Verify: Create a single Java file in an empty folder → LS ready → editing experience works +# +# Prerequisites: +# - JDK installed and available +# +# Usage: autotest run test-plans/java-single-file.yaml + +name: "Java Single File — Single File Editing Experience" +description: | + Corresponds to the Single file scenario in the wiki Test Plan: + Open a Java file in an empty folder, verify the language server starts normally, + editing experience including code snippets, diagnostics, and completion works correctly. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + # Use simple-app's App.java as the single file scenario + # The framework will automatically copy to a temporary directory + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" + timeout: 60 + +steps: + # ── Step 1: Wait for LS ready ──────────────────────────────── + # wiki: "Check the language server is initialized, and the + # status bar icon is 👍 after that." + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 120 + + # ── Step 2: Open Java file ────────────────────────────── + - id: "open-app" + action: "open file App.java" + verify: "App.java file is opened in the editor" + timeout: 10 + + # ── Step 3: Verify code completion ──────────────────────────── + # wiki: "make sure the editing experience is correctly working + # including diagnostics, code completion and code action." + - id: "verify-completion" + action: "triggerCompletion" + verify: "Code completion list appears" + verifyCompletion: + notEmpty: true + + # ── Step 4: Verify basic editing ──────────────────────────── + - id: "goto-main" + action: "goToLine 6" + verify: "Cursor moved to main method" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-code" + action: "typeInEditor \n System.out.println(\"Hello\");" + verifyEditor: + contains: "System.out.println" diff --git a/test-plans/java-single-no-workspace.yaml b/test-plans/java-single-no-workspace.yaml new file mode 100644 index 00000000..38b19412 --- /dev/null +++ b/test-plans/java-single-no-workspace.yaml @@ -0,0 +1,60 @@ +# Test Plan: Single File Without Workspace (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Single file without workspace" scenario +# Verify: Open a single Java file without workspace → LS ready → editing experience works +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-single-no-workspace.yaml + +name: "Java Single File Without Workspace — No Workspace Single File" +description: | + Corresponds to the Single file without workspace scenario in the wiki Test Plan: + Directly open a Java file without workspace mode, + verify LS works normally and basic editing features are available. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + # Single file mode — no workspace set, only open a file + file: "../../vscode-java/test/resources/projects/eclipse/simple-app/src/app/App.java" + timeout: 60 + +steps: + # ── Step 1: Wait for LS ready ──────────────────────────────── + # wiki: "Wait for Java extension to be ready (the status bar icon is 👍)." + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 120 + + # ── Step 2: Verify file is opened ────────────────────────── + - id: "verify-file-open" + action: "wait 3 seconds" + verify: "App.java is opened" + verifyEditor: + contains: "Hello Java" + + # ── Step 3: Verify basic editing features ──────────────────────────── + # wiki: "Try the basic editing features in App.java, they should work." + - id: "verify-completion" + action: "triggerCompletion" + verify: "Code completion works correctly" + verifyCompletion: + notEmpty: true + + # ── Step 4: Verify editing ──────────────────────────────── + - id: "goto-line" + action: "goToLine 5" + + - id: "goto-end" + action: "goToEndOfLine" + + - id: "type-code" + action: "typeInEditor // no-workspace test" + verifyEditor: + contains: "// no-workspace test" diff --git a/test-plans/java-test-runner.yaml b/test-plans/java-test-runner.yaml new file mode 100644 index 00000000..ad5a50db --- /dev/null +++ b/test-plans/java-test-runner.yaml @@ -0,0 +1,59 @@ +# Test Plan: Java Test Runner (from vscode-java-pack.wiki) +# +# Source: wiki Test-Plan.md "Java Test Runner" scenario +# Verify: Test panel display → run all tests → CodeLens visible +# +# Uses maven/salut project (contains compilable Java source files) +# +# Prerequisites: +# - vscode-java repository cloned locally +# - JDK installed and available +# +# Usage: autotest run test-plans/java-test-runner.yaml + +name: "Java Test Runner — Test Panel and CodeLens" +description: | + Corresponds to the Java Test Runner scenario in the wiki Test Plan: + Verify the test panel can display test cases, and tests can be run via the panel or CodeLens. + +setup: + extension: "redhat.java" + extensions: + - "vscjava.vscode-java-pack" + vscodeVersion: "stable" + workspace: "../../vscode-java/test/resources/projects/maven/salut" + timeout: 90 + +steps: + # ── Wait for LS ready ───────────────────────────────────────── + - id: "ls-ready" + action: "waitForLanguageServer" + verify: "Status bar shows Java language server is ready" + timeout: 120 + + # ── Step 1: Open test panel ───────────────────────────────── + # wiki: "The test explorer can show test case." + - id: "open-test-explorer" + action: "openTestExplorer" + verify: "Test panel is opened, test case list is visible" + + # ── Step 2: Run all tests ───────────────────────────────── + # wiki: "Can run the test cases by clicking Run All in test explorer" + - id: "run-all-tests" + action: "runAllTests" + verify: "Tests start running" + + - id: "wait-test-complete" + action: "wait 30 seconds" + verify: "Test run completed" + + # ── Step 3: Open test file to verify CodeLens ──────────────────── + # wiki: "Open a Java test file, the Code Lens could show above each test cases" + - id: "open-test-file" + action: "open file Foo.java" + verify: "Test file is opened" + timeout: 10 + + - id: "verify-codelens" + action: "wait 5 seconds" + verify: "CodeLens appears above test cases (Run Test / Debug Test)"