|
| 1 | +# Test Plan: Java Basic Editing (from vscode-java-pack.wiki) |
| 2 | +# |
| 3 | +# Source: wiki Test-Plan.md "Basic" scenario (Steps 1-5) |
| 4 | +# Verify: Open Eclipse project → Language Server ready → Code snippet → Code Action fixes error |
| 5 | +# |
| 6 | +# Prerequisites: |
| 7 | +# - vscode-java repository cloned locally |
| 8 | +# - JDK installed and available |
| 9 | +# |
| 10 | +# Usage: autotest run test-plans/java-basic-editing.yaml |
| 11 | + |
| 12 | +name: "Java Basic Editing — Diagnostics, Code Snippets, Code Action" |
| 13 | +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. |
| 18 | +
|
| 19 | +setup: |
| 20 | + extension: "redhat.java" |
| 21 | + extensions: |
| 22 | + - "vscjava.vscode-java-pack" |
| 23 | + # To test extension dev version, uncomment: |
| 24 | + # extensionPath: "../../vscode-java" |
| 25 | + vscodeVersion: "stable" |
| 26 | + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" |
| 27 | + timeout: 60 # Java LS starts slowly, needs sufficient wait time |
| 28 | + |
| 29 | +steps: |
| 30 | + # ── Step 1: Open project ────────────────────────────────── |
| 31 | + - id: "project-loaded" |
| 32 | + action: "wait 5 seconds" |
| 33 | + verify: "Project file tree is visible" |
| 34 | + |
| 35 | + # ── Step 2: Language Server ready + diagnostics ────────── |
| 36 | + # wiki: "After the language server is initialized, check the status bar |
| 37 | + # icon is 👍, and the problems view has two errors." |
| 38 | + - id: "ls-ready" |
| 39 | + action: "waitForLanguageServer" |
| 40 | + verify: "Status bar shows Java Language Server is ready (👍 icon)" |
| 41 | + verifyProblems: |
| 42 | + errors: 2 |
| 43 | + timeout: 120 |
| 44 | + |
| 45 | + # ── Step 3: Fix Foo.java (write class skeleton) ───────────── |
| 46 | + # wiki: "Select Foo.java file, invoke `class` code snippet to generate code |
| 47 | + # 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) |
| 49 | + - id: "open-foo" |
| 50 | + action: "open file Foo.java" |
| 51 | + verify: "Foo.java file is opened in the editor" |
| 52 | + timeout: 15 |
| 53 | + |
| 54 | + - id: "write-class-body" |
| 55 | + action: "insertLineInFile src/app/Foo.java 1 package app;\n\npublic class Foo {\n\n}" |
| 56 | + verifyEditor: |
| 57 | + contains: "public class Foo" |
| 58 | + verifyProblems: |
| 59 | + errors: 1 |
| 60 | + timeout: 30 |
| 61 | + |
| 62 | + # ── Step 4: Create missing method call() ───────────────── |
| 63 | + # 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) |
| 65 | + - id: "add-call-method" |
| 66 | + action: "insertLineInFile src/app/Foo.java 4 public void call() {}\n" |
| 67 | + verifyProblems: |
| 68 | + errors: 0 |
| 69 | + timeout: 30 |
| 70 | + |
| 71 | + # ── Step 5: Save and verify no errors ──────────────────── |
| 72 | + # wiki: "Save all the files... There should be no errors." |
| 73 | + - id: "save-all" |
| 74 | + action: "run command File: Save All" |
| 75 | + verify: "All files saved, no compilation errors" |
| 76 | + verifyProblems: |
| 77 | + errors: 0 |
| 78 | + timeout: 30 |
0 commit comments