|
| 1 | +# Test Plan |
| 2 | + |
| 3 | +This document describes the manual test plan for the QL extension for Visual Studio Code. |
| 4 | + |
| 5 | +The plan will be executed manually to start with but the goal is to eventually automate parts of the process (based on |
| 6 | +effort vs value basis). |
| 7 | + |
| 8 | +#### What this doesn't cover |
| 9 | +We don't need to test features (and permutations of features) that are covered by automated tests. |
| 10 | + |
| 11 | +#### Areas to consider |
| 12 | +1. Running MRVA and viewing results |
| 13 | +2. Running local queries |
| 14 | +3. Interacting with the query history |
| 15 | +4. Exporting MRVA results |
| 16 | +5. Cancelling a MRVA run |
| 17 | +6. Changing colour theme |
| 18 | + |
| 19 | +### Before releasing the VS Code extension |
| 20 | +- Check major PRs since the previous release for specific one-off things to test. |
| 21 | +- Run a query using the existing version of the extension (to generate an “old” query history item) |
| 22 | +- Go through the required test cases listed below |
| 23 | + |
| 24 | +## Required Test Cases |
| 25 | + |
| 26 | +### Test Case 1: Running a problem path query and viewing results |
| 27 | + |
| 28 | +1. Open the [UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql). |
| 29 | +2. Run it against the following repo list: |
| 30 | +``` |
| 31 | +"test-repo-list": [ |
| 32 | + "angular-cn/ng-nice", |
| 33 | + "apache/hadoop", |
| 34 | + "apache/hive" |
| 35 | +] |
| 36 | +``` |
| 37 | +3. Check the notification message. It should: |
| 38 | + - Show the number of repos that are going to be queried |
| 39 | + - Provide a link to the actions workflow |
| 40 | +4. Check the query history. It should: |
| 41 | + - Show that an item has been added to the query history |
| 42 | + - The item should be marked as “in progress”. |
| 43 | +5. Once the query completes: |
| 44 | + - Check that a notification is shown with a link to the results view |
| 45 | + - Check the results view |
| 46 | + - Check the code paths view, including the code paths drop down menu. |
| 47 | + - Check that the repository filter box works |
| 48 | + - Click links to files/locations on GitHub. |
| 49 | + |
| 50 | +### Test Case 2: Running a problem query and viewing results |
| 51 | + |
| 52 | +1. Open the [ReDoS query](https://github.com/github/codeql/blob/main/javascript/ql/src/Performance/ReDoS.ql). |
| 53 | +2. Run it against the "Top 10" repositories. |
| 54 | +3. Check the notification message. It should: |
| 55 | + - Show the number of repos that are going to be queried |
| 56 | + - Provide a link to the actions workflow |
| 57 | +4. Check the query history. It should: |
| 58 | + - Show that an item has been added to the query history |
| 59 | + - The item should be marked as “in progress”. |
| 60 | +5. Once the query completes: |
| 61 | + - Check that a notification is shown with a link to the results view |
| 62 | + - Check that the results are rendered with an alert message and a highlighted code snippet: |
| 63 | + |
| 64 | + |
| 65 | +### Test Case 3: Running a non-problem query and viewing results |
| 66 | + |
| 67 | +1. Open the [FunLinesOfCode query](https://github.com/github/codeql/blob/main/cpp/ql/src/Metrics/Functions/FunLinesOfCode.ql). |
| 68 | +2. Run it against a single repository (e.g. `google/brotli`). |
| 69 | +3. Once the query is complete: |
| 70 | + - Open the query results |
| 71 | + - Check that the results show up in a table: |
| 72 | + |
| 73 | + |
| 74 | +### Test Case 4: Interacting with query history |
| 75 | + |
| 76 | +1. Click a history item (for MRVA): |
| 77 | + - Check that exporting results works |
| 78 | + - Check that sorting results works |
| 79 | + - Check that copying repo lists works |
| 80 | +2. Open the query directory (containing results): |
| 81 | + - Check that the correct directory is opened and there are results in it |
| 82 | +3. Open variant analysis on GitHub |
| 83 | + - Check that the correct workflow is opened |
| 84 | + |
| 85 | +### Test Case 5: Cancelling a variant analysis run |
| 86 | + |
| 87 | +When running one of the above queries, try cancelling one from within VS Code: |
| 88 | +- Check that the query is cancelled and the query history item is updated. |
| 89 | +- Check that the workflow run is also cancelled. |
| 90 | +- Check that any available results are visible in VS Code. |
| 91 | + |
| 92 | +### Test Case 6: Change to a different colour theme |
| 93 | + |
| 94 | +When running one of the above queries, try changing to a different colour theme |
| 95 | +and check that everything looks sensible. Are there any components that are not showing up? |
| 96 | + |
| 97 | +## Optional Test Cases |
| 98 | + |
| 99 | +### 1. Selecting repositories to run on |
| 100 | + |
| 101 | +#### Test case 1: Running a query on a single repository |
| 102 | +1. When the repository exists and is public |
| 103 | + 1. Has a CodeQL database for the correct language |
| 104 | + 2. Has a CodeQL database for another language |
| 105 | + 3. Does not have any CodeQL databases |
| 106 | +2. When the repository exists and is private |
| 107 | + 1. Is accessible and has a CodeQL database |
| 108 | + 2. Is not accessible |
| 109 | +3. When the repository does not exist |
| 110 | + |
| 111 | +#### Test case 2: Running a query on a custom repository list |
| 112 | +1. The repository list is non-empty |
| 113 | + 1. All repositories in the list have a CodeQL database |
| 114 | + 2. Some but not all repositories in the list have a CodeQL database |
| 115 | + 3. No repositories in the list have a CodeQL database |
| 116 | +2. The repository list is empty |
| 117 | + |
| 118 | +#### Test case 3: Running a query on a built-in repository list (i.e. topN) |
| 119 | +- Check that the query runs and results are shown |
| 120 | + |
| 121 | +#### Test case 4: Running a query on all repositories in an organization |
| 122 | +1. The org exists |
| 123 | + 1. The org contains repositories that have CodeQL databases |
| 124 | + 2. The org contains repositories of the right language but without CodeQL databases |
| 125 | + 3. The org contains repositories not of the right language |
| 126 | + 4. The org contains private repositories that are inaccessible |
| 127 | +2. The org does not exist |
| 128 | + |
| 129 | +### 2. Using different types of controller repos |
| 130 | +1. The controller is public |
| 131 | + 1. Can run queries on public repositories |
| 132 | + 2. Can not run queries on private repositories |
| 133 | +2. The controller is private |
| 134 | + 1. Can run queries on public repositories |
| 135 | + 2. Can run queries on private repositories |
| 136 | +3. The controller repo exists but you do not have write access |
| 137 | +4. The controller repo doesn’t exist |
| 138 | +5. The “config field” for the controller repo is not set |
| 139 | + |
| 140 | +### 3. Query History |
| 141 | +1. Query history is loaded when vscode starts |
| 142 | +- Handles when action workflow was cancelled while vscode was closed |
| 143 | +- Starts monitoring variant analyses |
| 144 | + - When variant analysis state is “pending” |
| 145 | + - When variant analysis state is “in_progress” |
| 146 | + - When variant analysis state is “succeded” |
| 147 | + - All results are downloaded |
| 148 | + - Not all results are downloaded |
| 149 | + - When variant analysis state is “failed” |
| 150 | + - Stops monitoring |
| 151 | +2. Can open query history item |
| 152 | +- Manually by clicking on them |
| 153 | +- Automatically when vscode starts (if they were open when vscode was last used) |
| 154 | +3. Can delete a query history item |
| 155 | +- Item is removed from list in UI |
| 156 | +- Files on dist are deleted (can get to files using “open query directory”) |
| 157 | +4. Can sort query history items |
| 158 | +- By name |
| 159 | +- By query date |
| 160 | +- By result count |
| 161 | +5. Can open query directory |
| 162 | +6. Can open query that produced these results |
| 163 | +- When the file still exists and has not moved |
| 164 | +- When the file does not exist |
| 165 | +7. Can open variant analysis on github |
| 166 | +- Option is not shown before an actions run has been scheduled |
| 167 | +- Option is shown when an actions run has been scheduled |
| 168 | +8. Can copy repository list |
| 169 | +- Option is not shown before all analyses have finished |
| 170 | +- Option is shown once all analyses are finished |
| 171 | +- Text is copied to clipboard |
| 172 | +- Text is a valid repository list |
| 173 | +9. Can export results |
| 174 | +- Option is not shown before all analyses have finished |
| 175 | +- Option is shown once all analyses are finished |
| 176 | +10. Can select to create gist |
| 177 | +- A gist is created |
| 178 | +- The first thing in the gist is a summary |
| 179 | +- Contains a file for each repository with results |
| 180 | +- A popup links you to the gist |
| 181 | +11. Can select to save as markdown |
| 182 | +- A directory is created on disk |
| 183 | +- Contains a summary file |
| 184 | +- Contains a file for each repository with results |
| 185 | +- A popup allows you to open the directory |
| 186 | +12. Can cancel analysis |
| 187 | +- Option is shown when analysis is in progress |
| 188 | +- Option is not shown once all analyses are finished |
| 189 | +- Option is not shown before action run has been started |
| 190 | +- Causes the actions run to be cancelled |
| 191 | + |
| 192 | +### 4. Results view |
| 193 | +1. Can open a results view |
| 194 | +- When variant analysis state is “pending” |
| 195 | +- When variant analysis state is “in_progress” |
| 196 | +- When variant analysis state is “succeeded” |
| 197 | +- When variant analysis state is “failed” |
| 198 | +- When variant analysis state is “canceled” |
| 199 | +2. Results view opens automatically |
| 200 | +- When starting variant analysis run |
| 201 | +- When vscode opens (if view was open when vscode was closed) |
| 202 | +3. Can copy repository list |
| 203 | +See section from query history. |
| 204 | +4. Can export results |
| 205 | +- Only includes repos that you have selected (also see section from query history) |
| 206 | +5. Can cancel analysis (see section from query history) |
| 207 | +6. Can open query file (see section from query history) |
| 208 | +7. Can open query text |
| 209 | +8. Can view logs when variant analysis in final state (succeeded/failed/cancelled) |
| 210 | +9. Can sort repos |
| 211 | + - By name |
| 212 | + - By results |
| 213 | + - By stars |
| 214 | + - By last commit |
| 215 | +10. Can filter repos |
| 216 | +11. Shows correct statistics |
| 217 | + - Total number of results |
| 218 | + - Total number of repositories |
| 219 | + - Duration |
| 220 | +13. Can see live results |
| 221 | + - Results appear in extension as soon as each query is completed |
| 222 | +14. Can view interpreted results (i.e. for a “problem” query) |
| 223 | + - Can view non-path results |
| 224 | + - Can view code paths for “path-problem” queries |
| 225 | +15. Can view raw results (i.e. for a non “problem” query) |
| 226 | + - Renders a table |
| 227 | +16. Can see skipped repositories |
| 228 | + - Can see repos with no db in a tab |
| 229 | + - Shown warning that explains the tab |
| 230 | + - Can see repos with no access in a tab |
| 231 | + - Shown warning that explains the tab |
| 232 | + - Only shows tab when there are skipped repos |
| 233 | +17. Result downloads |
| 234 | + - All results are downloaded automatically |
| 235 | + - Download status is indicated by a spinner (Not currently any indication of progress beyond “downloading” and “not downloading”) |
| 236 | + - Only 3 items are downloaded at a time |
| 237 | + - Results for completed queries are still downloaded when |
| 238 | + - Some but not all queries failed |
| 239 | + - The variant analysis was cancelled after some queries completed |
| 240 | + |
| 241 | +### 5. Upgrading from non-live to live results |
| 242 | + |
| 243 | +1. When you have an existing non-live remote query history item |
| 244 | + - Still opens the the non-live results view |
| 245 | +2. When you have a local query history item |
| 246 | + |
| 247 | +### 6. Downgrading from live to non-live results |
| 248 | + |
| 249 | +1. When you have live results query history items |
| 250 | + - Can still open existing live results query history items. |
| 251 | + This depends on the version you downgrade to, 1.7.6 works, but 1.6.12 doesn’t work because of an unsupported query history format |
| 252 | +2. New queries will be non-live remote queries |
| 253 | + |
| 254 | +### 7. Is all copy / text correct? |
| 255 | +- In prompts when running a query |
| 256 | +- In query history |
| 257 | +- In results view |
0 commit comments