Generate & Run Targeted Tests from Code Changes
The DevAssure O2 Agent Extension includes two execution actions based on the code changes in the Tests view: Test branch and Test commit. These actions start a full test session focused on code changes rather than a manually selected file, folder, or test collection, following the same change-aware model used by the CLI devassure test workflow.
This execution model is designed for teams that want testing to stay aligned with the actual code delta. It is especially useful for validating pull requests, feature branches, hotfixes, and recent commits without falling back to broad, static regression runs.
Git-aware execution helps the extension decide what to validate based on what changed. Instead of choosing tests only by location or file structure, the agent scopes execution to branch differences or a specific commit and then builds the test session around the affected code paths.
Test branch
Use Test branch when the goal is to validate the diff between a source branch and a base branch. This is the preferred mode for pre-merge checks, feature branch validation, and branch-to-branch change analysis.
Where to access it
- Open the DevAssure Tests view.
- Click Test branch.
Requirements
Before starting a branch-based session, make sure the selected project path is inside a valid git repository. If no DevAssure project is selected or the workspace is not ready, the action may be disabled or show a wait state.
Branch validation workflow
When Test branch is selected, the extension opens two quick-pick inputs at the top of the VS Code window :
- Test branch: Choose a branch from the list of local and remote branches, or type a branch name manually.
- Press Enter with no selection to use the current branch.
- Base branch: Choose a base branch from the list or type one manually.
- Press Enter with no selection to use the repository default branch.
The branch selection flow supports both discovery and manual input:
- The branch picker includes names from both
refs/headsandrefs/remotes. - The first input uses the placeholder “Branch to test (press enter to use current branch)”.
- The second input uses the placeholder “Base branch (press enter to use repo default)”.
This makes the flow flexible for teams working with local feature branches, remote tracking branches, and repositories where the default branch may differ across projects.
Execution result
After the inputs are completed, the extension starts a session that validates the diff between:
- Source = selected test branch or the current branch.
- Target = selected base branch or the repository default branch.
The agent then scopes the run to the impacted code changes and begins the corresponding test session.
Test commit
Use Test commit when the goal is to validate a specific commit instead of comparing two branches. This mode is more precise than branch testing when the change set is already isolated to a known commit.
Where to access it
- Open the DevAssure Tests view.
- Click Test commit.
Commit validation workflow
When Test commit is selected, the extension opens a quick pick focused on recent repository history:
- The picker shows the 20 most recent commits.
- Each entry includes a short hash and commit subject.
- Select a listed commit or type a full commit ID manually.
- Press Enter with no selection to use the current commit (HEAD).
The commit input is built to support both quick selection and exact targeting:
- Recent commits are displayed for fast lookup.
- Full commit hashes can be typed when the desired revision is not in the visible list.
- The input uses the placeholder “Commit ID (press enter to use current commit)”.
Execution result
Once the commit is selected, the extension starts a session focused on the code changes introduced by that commit. The resulting run is scoped to the selected revision rather than a broader branch comparison.
Choosing the right run mode
Different run modes are designed for different development and validation tasks. Use the table below to choose the most appropriate execution path for the work at hand.
| Run mode | Best use case |
|---|---|
| Single file | Validate or debug one scenario while authoring a test. |
| Folder | Run all tests for one feature area or module. |
| All tests | Broad regression or release-readiness checks. |
| CSV file | Execute spreadsheet-driven scenarios or imported test definitions. |
| CodeLens | Run the file currently being edited without switching views. |
| Test branch | Validate a branch diff before merge or review. |
| Test commit | Validate a specific commit or hotfix changeset. |
The IDE extension is designed primarily for local, editor-based workflows. For CI or other headless environments, DevAssure recommends using the CLI with token-based authentication and commands such as devassure run-tests or devassure test.[7]