π€ AI-powered test repair for GitHub Actions - automatically fix failing tests with intelligent repair suggestions.
- AI-Powered Test Repair: Automatically repairs failing tests using advanced AI
- Configurable Success Criteria: Choose between original success only or repair success with confidence thresholds
- Pull Request Integration: Automatically creates PRs with repaired test files
- Comprehensive Reporting: Detailed metrics on test execution and repair success rates
- CI/CD Integration: Seamlessly integrates with existing GitHub workflows
Add these secrets to your repository:
- Go to your repository β Settings β Secrets and variables β Actions
- Add these repository secrets:
TESTCHIMP_API_KEY: Your TestChimp project API keyTESTCHIMP_PROJECT_ID: Your TestChimp project ID
The action requires specific permissions to write to the repository and create pull requests:
- Go to your repository β Settings β Actions β General
- Under "Workflow permissions", select "Read and write permissions"
- Check "Allow GitHub Actions to create and approve pull requests"
Create .github/workflows/run_tests.yml:
name: TestChimp AI Test Repair
on: [push, pull_request]
jobs:
testchimp-tests:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run TestChimp Tests with AI Repair
id: testchimp
uses: awarelabshq/testchimp-github-testrunner@v1.0.16
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
api-key: ${{ secrets.TESTCHIMP_API_KEY }}
project-id: ${{ secrets.TESTCHIMP_PROJECT_ID }}
test-directory: "tests"
success-criteria: "REPAIR_SUCCESS_WITH_CONFIDENCE"
repair-confidence-threshold: "4"Push your code or create a pull request - TestChimp will automatically:
- Scan for TestChimp-managed tests
- Execute tests with AI repair capabilities
- Create pull requests with repaired files (if any repairs are made)
- Provide detailed reporting on test results
| Parameter | Description |
|---|---|
api-key |
TestChimp project API key |
project-id |
TestChimp project ID |
| Parameter | Default | Description |
|---|---|---|
test-directory |
tests |
Directory to scan for tests |
success-criteria |
ORIGINAL_SUCCESS |
Success criteria (ORIGINAL_SUCCESS or REPAIR_SUCCESS_WITH_CONFIDENCE) |
repair-confidence-threshold |
4 |
Minimum confidence score (1-5) for repair success |
mode |
RUN_WITH_AI_REPAIR |
Execution mode |
deflake-runs |
2 |
Number of deflake runs to attempt |
max-workers |
4 |
Maximum number of parallel test workers (1-10) |
fixtures-directory |
(empty) | Directory containing fixture files for file uploads (relative to repository root). Required if tests use setInputFiles() with relative paths. |
Only tests that pass on their original run are considered successful. AI repairs don't count as success.
success-criteria: 'ORIGINAL_SUCCESS'Tests that either pass originally OR are successfully repaired with sufficient confidence.
success-criteria: 'REPAIR_SUCCESS_WITH_CONFIDENCE'
repair-confidence-threshold: '4' # 1-5 scaleIf your tests use setInputFiles() with relative file paths (e.g., 'fixtures/file.pdf'), you need to configure the fixtures-directory parameter to tell the action where your fixture files are located.
How it works:
- The action resolves the fixtures directory relative to your repository root
- Runner-core uses this directory to resolve relative file paths in
setInputFiles()calls - Absolute file paths are used as-is (not modified)
Example:
- name: TestChimp AI Repair
uses: awarelabshq/testchimp-github-testrunner@v1.0.16
with:
api-key: ${{ secrets.TESTCHIMP_API_KEY }}
project-id: ${{ secrets.TESTCHIMP_PROJECT_ID }}
test-directory: 'tests'
fixtures-directory: 'fixtures' # Relative to repo rootIn your test:
// This will resolve to: <repo-root>/fixtures/document.pdf
await page.setInputFiles('input[type="file"]', 'fixtures/document.pdf');Note: If fixtures-directory is not specified and your tests use relative paths in setInputFiles(), the file uploads will fail. Absolute paths work without configuration.
The action supports parallel test execution to improve performance. Use the max-workers parameter to control the number of concurrent test workers:
max-workers: '3' # Run up to 6 tests in parallelGuidelines:
- Default: 3 workers (good balance for most projects)
- Range: 1-10 workers
- Low-resource projects: Use 1-2 workers
- High-performance projects: Use 6-8 workers
- Memory-intensive tests: Use fewer workers to avoid resource conflicts
Example with parallel execution:
- name: Run TestChimp Tests with AI Repair
uses: awarelabshq/testchimp-github-testrunner@v1.0.16
with:
api-key: ${{ secrets.TESTCHIMP_API_KEY }}
project-id: ${{ secrets.TESTCHIMP_PROJECT_ID }}
max-workers: '6'
test-directory: "tests"The action provides these outputs:
| Parameter | Description |
|---|---|
status |
Overall execution status (success/failed) |
test-count |
Number of tests executed |
success-count |
Number of successful tests |
failure-count |
Number of failed tests |
repaired-count |
Number of tests that were repaired |
repaired-above-threshold |
Number of tests repaired with confidence above threshold |
repaired-below-threshold |
Number of tests repaired with confidence below threshold |
success-criteria-used |
Success criteria that was applied |
pull-request-number |
Number of created PR (if any) |
pull-request-url |
URL of created PR (if any) |
- name: TestChimp AI Repair
uses: testchimp/testchimp-github-action@v1.0.0
with:
api-key: ${{ secrets.TESTCHIMP_API_KEY }}
project-id: ${{ secrets.TESTCHIMP_PROJECT_ID }}name: TestChimp AI Test Repair
on: [push, pull_request]
jobs:
testchimp-tests:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: TestChimp AI Repair
uses: awarelabshq/testchimp-github-testrunner@v1.0.16
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
api-key: ${{ secrets.TESTCHIMP_API_KEY }}
project-id: ${{ secrets.TESTCHIMP_PROJECT_ID }}
test-directory: 'e2e-tests'
fixtures-directory: 'fixtures' # For file upload support
success-criteria: 'REPAIR_SUCCESS_WITH_CONFIDENCE'
repair-confidence-threshold: '3'
max-workers: '6'name: TestChimp AI Test Repair
on: [push, pull_request]
jobs:
testchimp-tests:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: TestChimp AI Repair
id: testchimp
uses: awarelabshq/testchimp-github-testrunner@v1.0.16
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
api-key: ${{ secrets.TESTCHIMP_API_KEY }}
project-id: ${{ secrets.TESTCHIMP_PROJECT_ID }}
- name: Display Results
run: |
echo "Tests executed: ${{ steps.testchimp.outputs.test-count }}"
echo "Tests passed: ${{ steps.testchimp.outputs.success-count }}"
echo "Tests repaired: ${{ steps.testchimp.outputs.repaired-count }}"Check the examples/ directory for:
basic-usage.yml- Simple workflow setupadvanced-usage.yml- Different success criteria configurationsci-integration.yml- Integration with existing CI/CD pipelines
- Authentication errors: Ensure
TESTCHIMP_API_KEYandTESTCHIMP_PROJECT_IDsecrets are set correctly - Permission denied errors: Verify repository permissions are set to "Read and write permissions" and "Allow GitHub Actions to create and approve pull requests" is enabled
- No tests found: Check that your test directory contains TestChimp-managed tests
- Repairs not accepted: Verify your confidence threshold isn't too high
- Resource exhaustion: Reduce
max-workersif tests are failing due to memory or CPU limits
The action provides detailed logging:
- Success criteria being used
- Confidence threshold for repairs
- Individual test results with confidence scores
- Summary statistics including repair counts
- π Full Documentation
- π Report Issues
- π¬ Ask Questions
This project is licensed under the MIT License - see the LICENSE file for details.