|
| 1 | +# Test Plan: Java Basic (from vscode-java-pack.wiki) |
| 2 | +# |
| 3 | +# Source: wiki Test-Plan.md "Basic" scenario (Steps 1-8) |
| 4 | +# Verifies: LS ready → class snippet → Code Action → completion → Organize Imports → Rename |
| 5 | +# |
| 6 | +# Prerequisites: |
| 7 | +# - vscode-java repo cloned locally |
| 8 | +# - JDK installed |
| 9 | +# |
| 10 | +# Usage: autotest run test-plans/java-basic-editing.yaml |
| 11 | + |
| 12 | +name: "Java Basic — Full Scenario (Steps 1-8)" |
| 13 | +description: | |
| 14 | + Wiki Basic scenario steps 1-8 in a single run: |
| 15 | + 1-2: Open simple-app, verify LS ready with 2 errors |
| 16 | + 3: Class snippet to fix Foo.java |
| 17 | + 4: Code Action to create missing call() method |
| 18 | + 5: Save all, verify 0 errors |
| 19 | + 6: Type File code, verify completion |
| 20 | + 7: Organize Imports (Shift+Alt+O) |
| 21 | + 8: Rename Symbol (F2) |
| 22 | +
|
| 23 | +setup: |
| 24 | + extension: "redhat.java" |
| 25 | + extensions: |
| 26 | + - "vscjava.vscode-java-pack" |
| 27 | + vscodeVersion: "stable" |
| 28 | + workspace: "../../vscode-java/test/resources/projects/eclipse/simple-app" |
| 29 | + timeout: 60 |
| 30 | + |
| 31 | +steps: |
| 32 | + # ══════════════════════════════════════════════════════════ |
| 33 | + # Steps 1-5: Diagnostics, Snippet, Code Action |
| 34 | + # ══════════════════════════════════════════════════════════ |
| 35 | + |
| 36 | + # ── Step 1: Project loaded ────────────────────────────────── |
| 37 | + - id: "project-loaded" |
| 38 | + action: "wait 5 seconds" |
| 39 | + verify: "Project file tree is visible" |
| 40 | + |
| 41 | + # ── Step 2: LS ready + 2 errors ───────────────────────────── |
| 42 | + - id: "ls-ready" |
| 43 | + action: "waitForLanguageServer" |
| 44 | + verify: "Status bar shows Language Server is ready with 2 errors" |
| 45 | + verifyProblems: |
| 46 | + errors: 2 |
| 47 | + timeout: 120 |
| 48 | + |
| 49 | + # ── Step 3: Class snippet in Foo.java ─────────────────────── |
| 50 | + - id: "open-foo" |
| 51 | + action: "open file Foo.java" |
| 52 | + verify: "Foo.java is open in editor" |
| 53 | + timeout: 15 |
| 54 | + |
| 55 | + - id: "type-class-snippet" |
| 56 | + action: "typeAndTriggerSnippet class" |
| 57 | + verify: "Class skeleton generated via snippet" |
| 58 | + verifyEditor: |
| 59 | + contains: "public class Foo" |
| 60 | + timeout: 30 |
| 61 | + |
| 62 | + - id: "save-foo" |
| 63 | + action: "saveFile" |
| 64 | + verifyProblems: |
| 65 | + errors: 1 |
| 66 | + timeout: 30 |
| 67 | + |
| 68 | + # ── Step 4: Code Action to create call() ──────────────────── |
| 69 | + - id: "close-all-before-codeaction" |
| 70 | + action: "run command Workbench: Close All Editors" |
| 71 | + |
| 72 | + - id: "navigate-to-error" |
| 73 | + action: "navigateToError 1" |
| 74 | + verify: "Cursor jumped to f.call() error in Bar.java" |
| 75 | + |
| 76 | + - id: "apply-code-action" |
| 77 | + action: "applyCodeAction Create method 'call()'" |
| 78 | + verify: "Code Action created call() method in Foo.java" |
| 79 | + timeout: 15 |
| 80 | + |
| 81 | + # ── Step 5: Save all + verify 0 errors ────────────────────── |
| 82 | + - id: "save-all-step5" |
| 83 | + action: "run command File: Save All" |
| 84 | + verify: "All files saved, no compilation errors" |
| 85 | + verifyProblems: |
| 86 | + errors: 0 |
| 87 | + timeout: 60 |
| 88 | + |
| 89 | + # ══════════════════════════════════════════════════════════ |
| 90 | + # Steps 6-8: Completion, Organize Imports, Rename |
| 91 | + # ══════════════════════════════════════════════════════════ |
| 92 | + |
| 93 | + # Close all editors to prevent duplicate tab issues |
| 94 | + - id: "close-all-before-step6" |
| 95 | + action: "run command Workbench: Close All Editors" |
| 96 | + |
| 97 | + # ── Step 6: Type File code ──────────────────────────────── |
| 98 | + # Use insertLineInFile so LS properly detects the unresolved File type |
| 99 | + - id: "open-app" |
| 100 | + action: "open file App.java" |
| 101 | + verify: "App.java is open in editor" |
| 102 | + timeout: 10 |
| 103 | + |
| 104 | + - id: "insert-file-code" |
| 105 | + action: "insertLineInFile src/app/App.java 6 File f = new File(\"demo.txt\");" |
| 106 | + verifyEditor: |
| 107 | + contains: "File f = new File" |
| 108 | + verifyProblems: |
| 109 | + errors: 1 |
| 110 | + atLeast: true |
| 111 | + timeout: 30 |
| 112 | + |
| 113 | + # ── Step 7: Organize Imports (Shift+Alt+O) ────────────────── |
| 114 | + - id: "organize-imports" |
| 115 | + action: "organizeImports" |
| 116 | + verify: "Organize Imports resolved File type" |
| 117 | + timeout: 15 |
| 118 | + |
| 119 | + # Save all — LS may write the import to a second tab (dual-tab issue on CI) |
| 120 | + # Verify via file on disk to bypass dual-tab problem |
| 121 | + - id: "save-after-organize" |
| 122 | + action: "run command File: Save All" |
| 123 | + verify: "App.java on disk contains import java.io.File" |
| 124 | + verifyFile: |
| 125 | + path: "~/src/app/App.java" |
| 126 | + contains: "import java.io.File" |
| 127 | + timeout: 10 |
| 128 | + |
| 129 | + # ── Step 8: Rename Symbol (F2) ────────────────────────────── |
| 130 | + - id: "close-all-before-rename" |
| 131 | + action: "run command Workbench: Close All Editors" |
| 132 | + |
| 133 | + - id: "open-foo-for-rename" |
| 134 | + action: "open file Foo.java" |
| 135 | + verify: "Foo.java is open in editor" |
| 136 | + timeout: 10 |
| 137 | + |
| 138 | + # Place cursor on "Foo" — use Find to locate the text, then close Find (cursor stays on it) |
| 139 | + - id: "find-foo-class" |
| 140 | + action: "findText Foo" |
| 141 | + |
| 142 | + - id: "rename-foo-to-foonew" |
| 143 | + action: "renameSymbol FooNew" |
| 144 | + timeout: 15 |
| 145 | + |
| 146 | + # LS renames file to FooNew.java — close stale tab and click renamed file in Explorer |
| 147 | + - id: "save-after-rename" |
| 148 | + action: "run command File: Save All" |
| 149 | + |
| 150 | + - id: "close-all-after-rename" |
| 151 | + action: "run command Workbench: Close All Editors" |
| 152 | + |
| 153 | + - id: "click-foonew-in-explorer" |
| 154 | + action: "doubleClick FooNew.java" |
| 155 | + verify: "FooNew.java shows renamed class" |
| 156 | + verifyEditor: |
| 157 | + contains: "public class FooNew" |
| 158 | + timeout: 15 |
0 commit comments