12 KiB
Test Plan
This document describes the manual test plan for the QL extension for Visual Studio Code.
The plan will be executed manually to start with but the goal is to eventually automate parts of the process (based on effort vs value basis).
What this doesn't cover
We don't need to test features (and permutations of features) that are covered by automated tests.
Before releasing the VS Code extension
- Go through the required test cases listed below
- Check major PRs since the previous release for specific one-off things to test. Based on that, you might want to choose to go through some of the Optional Test Cases.
- Run a query using the existing version of the extension (to generate an "old" query history item)
Required Test Cases
Test Case 1: MRVA - Running a problem path query and viewing results
-
Open the UnsafeJQueryPlugin query.
-
Run a MRVA against the following repo list:
{ "name": "test-repo-list", "repositories": [ "angular-cn/ng-nice", "apache/hadoop", "apache/hive" ] }
-
Check that a notification message pops up and the results view is opened.
-
Check the query history. It should:
- Show that an item has been added to the query history
- The item should be marked as "in progress".
-
Once the query starts:
- Check the results view
- Check the code paths view, including the code paths drop down menu.
- Check that the repository filter box works
- Click links to files/locations on GitHub
- Check that the query history item is updated to show the number of results
-
Once the query completes:
- Check that the query history item is updated to show the query status as "complete"
Test Case 2: MRVA - Running a problem query and viewing results
- Open the ReDoS query.
- Run a MRVA against the "Top 10" repositories.
- Check that there is a notification message.
- Check the query history. It should:
- Show that an item has been added to the query history
- The item should be marked as "in progress".
- Once the query starts:
Test Case 3: MRVA - Running a non-problem query and viewing results
- Open the FunLinesOfCode query.
- Run a MRVA against a single repository (e.g.
google/brotli
). - Once the query starts:
Test Case 4: MRVA - Interacting with query history
- Click a history item (for MRVA):
- Check that exporting results works
- Check that sorting results works
- Check that copying repo lists works
- Open the query results directory:
- Check that the correct directory is opened and there are results in it
- View logs
- Check that the correct workflow is opened
Test Case 5: MRVA - Canceling a variant analysis run
Run one of the above MRVAs, but cancel it from within VS Code:
- Check that the query is canceled and the query history item is updated.
- Check that the workflow run is also canceled.
- Check that any available results are visible in VS Code.
Test Case 6: MRVA - Change to a different colour theme
Open one of the above MRVAs, try changing to a different colour theme and check that everything looks sensible. Are there any components that are not showing up?
Optional Test Cases
These are mostly aimed at MRVA, but some of them are also applicable to non-MRVA queries.
Selecting repositories to run on
Test case 1: Running a query on a single repository
- When the repository exists and is public
- Has a CodeQL database for the correct language
- Has a CodeQL database for another language
- Does not have any CodeQL databases
- When the repository exists and is private
- Is accessible and has a CodeQL database
- Is not accessible
- When the repository does not exist
Test case 2: Running a query on a custom repository list
- The repository list is non-empty
- All repositories in the list have a CodeQL database
- Some but not all repositories in the list have a CodeQL database
- No repositories in the list have a CodeQL database
- The repository list is empty
Test case 3: Running a query on all repositories in an organization
- The org exists
- The org contains repositories that have CodeQL databases
- The org contains repositories of the right language but without CodeQL databases
- The org contains repositories not of the right language
- The org contains private repositories that are inaccessible
- The org does not exist
Using different types of controller repos
Test case 1: Running a query when the controller repository is public
- Can run queries on public repositories
- Can not run queries on private repositories
Test case 2: Running a query when the controller repository is private
- Can run queries on public repositories
- Can run queries on private repositories
Test case 3: Running a query when the controller repo exists but you do not have write access
- Cannot run queries
Test case 4: Running a query when the controller repo doesn’t exist
- Cannot run queries
Test case 5: Running a query when the "config field" for the controller repo is not set
- Cannot run queries
Query History
This requires running a MRVA query and viewing the query history.
The first test case specifies actions that you can do when the query is first run and is in "pending" state. We start with this since it has quite a limited number of actions you can do.
Test case 1: When variant analysis state is "pending"
- Starts monitoring variant analysis
- Cannot open query history item
- Can delete a query history item
- Item is removed from list in UI
- Files on dist are deleted (can get to files using "open query directory")
- Can sort query history items
- By name
- By query date
- By result count
- Cannot open query directory
- Can open query that produced these results
- When the file still exists and has not moved
- When the file does not exist
- Cannot view logs
- Cannot copy repository list
- Cannot export results
- Cannot select to create a gist
- Cannot select to save as markdown
- Cannot cancel analysis
Test case 2: When the variant analysis state is not "pending"
- Query history is loaded when VSCode starts
- Handles when action workflow was canceled while VSCode was closed
- Can open query history item
- Manually by clicking on them
- Automatically when VSCode starts (if they were open when VSCode was last used)
- Can delete a query history item
- Item is removed from list in UI
- Files on dist are deleted (can get to files using "open query directory")
- Can sort query history items
- By name
- By query date
- By result count
- Can open query directory
- Can open query that produced these results
- When the file still exists and has not moved
- When the file does not exist
- Can view logs
- Can copy repository list
- Text is copied to clipboard
- Text is a valid repository list
- Can export results
- Can select to create gist
- A gist is created
- The first thing in the gist is a summary
- Contains a file for each repository with results
- A popup links you to the gist
- Can select to save as markdown
- A directory is created on disk
- Contains a summary file
- Contains a file for each repository with results
- A popup allows you to open the directory
Test case 3: When variant analysis state is "in_progress"
- Starts monitoring variant analysis
- Ready results are downloaded
- Can cancel analysis
- Causes the actions run to be canceled
Test case 4: When variant analysis state is in final state ("succeeded"/"failed"/"canceled")
- Stops monitoring variant analysis
- All results are downloaded if state is succeeded
- Otherwise, ready results are downloaded, if any are available
- Cannot cancel analysis
MRVA results view
This requires running a MRVA query and seeing the results view.
Test case 1: When variant analysis state is "pending"
- Can open a results view
- Results view opens automatically
- When starting variant analysis run
- When VSCode opens (if view was open when VSCode was closed)
- Results view is empty
Test case 2: When variant analysis state is not "pending"
- Can open a results view
- Results view opens automatically
- When starting variant analysis run
- When VSCode opens (if view was open when VSCode was closed)
- Can copy repository list
- Text is copied to clipboard
- Text is a valid repository list
- Can export results
- Only includes repos that you have selected (also see section from query history)
- Can cancel analysis
- Can open query file
- When the file still exists and has not moved
- When the file does not exist
- Can open query text
- Can sort repos
- By name
- By results
- By stars
- By last updated
- Can filter repos
- Shows correct statistics
- Total number of results
- Total number of repositories
- Duration
- Can see live results
- Results appear in extension as soon as each query is completed
- Can view interpreted results (i.e. for a "problem" query)
- Can view non-path results
- Can view code paths for "path-problem" queries
- Can view raw results (i.e. for a non "problem" query)
- Renders a table
- Can see skipped repositories
- Can see repos with no db in a tab
- Shown warning that explains the tab
- Can see repos with no access in a tab
- Shown warning that explains the tab
- Only shows tab when there are skipped repos
- Can see repos with no db in a tab
- Result downloads
- All results are downloaded automatically
- Download status is indicated by a spinner (Not currently any indication of progress beyond "downloading" and "not downloading")
- Only 3 items are downloaded at a time
- Results for completed queries are still downloaded when
- Some but not all queries failed
- The variant analysis was canceled after some queries completed
Test case 3: When variant analysis state is in "succeeded" state
- Can view logs
- All results are downloaded
Test case 4: When variant analysis is in "failed" or "canceled" state
- Can view logs
- Results for finished queries are still downloaded.
MRVA repositories panel
- Add a list
- Add a database at the top level
- Add a database to a list
- Add a the same database at a top-level and in a list
- Delete a list
- Delete a database from the top level
- Delete a database from a list
- Add an owner
- Remove an owner
- Rename a list
- Open on GitHub
- Select a list (via "Select" button and via context menu action)
- Run MRVA against a user-defined list
- Run MRVA against a top-N list
- Run MRVA against an owner
- Run MRVA against a database
- Copy repo list
- Open config file
- Make changes via config file (ensure JSON schema is helping out)
- Close and re-open VS Code (ensure lists are there)
- Collapse/expand tree nodes
Error cases that trigger an error notification:
- Try to add a list with a name that already exists
- Try to add a top-level database that already exists
- Try to add a database in a list that already exists in the list
Error cases that show an error in the panel (and only the edit button should be visible):
- Edit the db config file directly and save invalid JSON
- Edit the db config file directly and save valid JSON but invalid config (e.g. add an unknown property)
- Edit the db config file directly and save two lists with the same name
Cases where there the welcome view is shown:
- No controller repo is set in the user's settings JSON.