Smart Test Selection
Run subsets of tests using strategies like recent failures, high priority, smoke, changed routes, and regression risk.
Smart Test Selection
Instead of running every test case every time, use smart selection strategies to run only the tests that matter. This cuts 30-minute full runs down to minutes — ideal for CI pipelines and quick feedback loops.
Smart selection lets you run focused test subsets in CI — catching regressions in minutes instead of running the full suite every time.
Available Strategies
| Strategy | What It Runs | Best For |
|---|---|---|
| all | Every test case in the project | Nightly / full regression runs |
| recent-failures | Cases that failed in the last 7 days | Quick re-validation after fixes |
| high-priority | Cases marked as high or critical priority | Critical path testing |
| smoke | One representative case per page URL | Fast sanity check across all pages |
| changed-routes | Cases matching a URL pattern you provide | Testing specific areas after deployment |
| regression-risk | Cases with high priority + recent failure history (excludes known flaky tests) | Targeted regression prevention |
Using Smart Selection in the UI
Navigate to Test Manager in the sidebar.
Click the Run All button to open the run options modal.
In the Test Selection Strategy section, pick a strategy. Each shows the estimated number of test cases that will run.
Click Run. The selected strategy resolves to specific test case IDs before execution begins.
Using Smart Selection via API
List Available Strategies
GET /api/v1/projects/:projectId/selection-strategies
Response:
{
"strategies": [
{ "key": "all", "label": "All Tests", "description": "Run every test case", "estimatedCount": 4858 },
{ "key": "recent-failures", "label": "Recent Failures", "description": "Cases that failed in last 7 days", "estimatedCount": 1683 },
{ "key": "high-priority", "label": "High Priority", "description": "Critical and high priority cases", "estimatedCount": 0 },
{ "key": "smoke", "label": "Smoke Tests", "description": "One case per page URL", "estimatedCount": 438 },
{ "key": "changed-routes", "label": "Changed Routes", "description": "Cases matching a URL pattern", "estimatedCount": null },
{ "key": "regression-risk", "label": "Regression Risk", "description": "High-risk cases based on priority and failure history", "estimatedCount": 0 }
]
}
Create a Run with a Strategy
POST /api/v1/test-runs
{
"projectId": "your-project-id",
"runType": "project",
"selectionStrategy": "smoke"
}
The backend resolves the strategy to specific case IDs before executing. The run header will show a smoke badge to indicate which strategy was used.
Changed Routes Strategy
The changed-routes strategy requires a urlPattern parameter:
POST /api/v1/test-runs
{
"projectId": "your-project-id",
"runType": "project",
"selectionStrategy": "changed-routes",
"selectionParams": {
"urlPattern": "/checkout"
}
}
This runs all test cases whose page URL contains /checkout.
CI/CD Integration
Smart selection works with the CI trigger endpoint. Use different strategies for different pipeline stages:
Use smoke on every PR for fast feedback. Use recent-failures on merge to main. Reserve all for nightly runs.
GitHub Actions Example
# PR checks - fast smoke tests
- name: Run Smoke Tests
run: |
curl -X POST https://aegisrunner.com/api/v1/ci/trigger \
-H "Authorization: Bearer ${{ secrets.AEGIS_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"projectId": "YOUR_PROJECT_ID", "selectionStrategy": "smoke"}'
# Nightly - full regression
- name: Run Full Tests
run: |
curl -X POST https://aegisrunner.com/api/v1/ci/trigger \
-H "Authorization: Bearer ${{ secrets.AEGIS_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"projectId": "YOUR_PROJECT_ID", "selectionStrategy": "all"}'
GitLab CI Example
smoke_tests:
stage: test
script:
- |
curl -X POST https://aegisrunner.com/api/v1/ci/trigger \
-H "Authorization: Bearer $AEGIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"projectId": "YOUR_PROJECT_ID", "selectionStrategy": "smoke"}'
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
full_regression:
stage: test
script:
- |
curl -X POST https://aegisrunner.com/api/v1/ci/trigger \
-H "Authorization: Bearer $AEGIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"projectId": "YOUR_PROJECT_ID", "selectionStrategy": "all"}'
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: always
Strategy Badge on Run Results
When viewing a completed run that used a selection strategy, a purple badge appears in the run header showing which strategy was used (e.g., smoke or recent-failures). This helps you distinguish targeted runs from full regression runs.
Combining with Failure Triage
Smart selection and failure triage work together. After a targeted run completes with failures, triage automatically analyzes just those failures. This gives you focused insights for the specific area you tested.
See Failure Triage for details on how AI analyzes and clusters test failures.