TestDriver offers advanced GitHub integration features, including the ability to create its own branches, trigger workflows manually from the GitHub Actions UI, and provide detailed outputs for debugging and reporting. These features make it easier to manage test workflows, collaborate on test results, and maintain a clean and automated testing pipeline.

Always remember to add a .gitignore file to your repository including a .env line so you never accidentally commit you TestDriver API key. This is important for security and to prevent exposing sensitive information. For more info see GitHub Docs.


1. Creating branches automatically

TestDriver can create its own branches to store test results, updates, or auto-healed tests. This ensures that test-related changes are isolated from the main codebase and can be reviewed before merging.

How it works

  • Branch Creation: TestDriver creates a new branch (for example, test-results or auto-heal-updates) during the workflow execution.
  • Pull Request: A pull request is automatically opened from the new branch to the base branch (for example, main), allowing developers to review the changes.

Example workflow with branch creation

.github/workflows/testdriver.yaml
name: TestDriver Auto-Healing

on:
  pull_request:
  workflow_dispatch:

jobs:
  test:
    name: Run Tests and Create Branch
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v2

      - name: Run TestDriver
        uses: testdriverai/action@main
        with:
          key: ${{ secrets.TD_API_KEY }}
          prompt: |
            1. Run all tests in the testdriver directory
          create-pr: true
          pr-title: "TestDriver Test Results"
          pr-branch: test-results
          pr-test-filename: testdriver-results.yaml
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FORCE_COLOR: "3"

Key fields

  • create-pr: true: Enables branch creation and pull request generation.
  • pr-branch: Specifies the branch name (for example, test-results).
  • pr-title: Sets the title of the pull request.
  • pr-test-filename: Specifies the filename for the test results.

2. Manual workflow dispatch

GitHub Actions supports manual triggering of workflows using the workflow_dispatch event. This allows you to run TestDriver workflows on demand, making it ideal for exploratory testing or debugging.

How to trigger workflows manually

  1. Navigate to the Actions tab in your GitHub repository.
  2. Select the workflow you want to run.
  3. Click the Run workflow button.
  4. Provide any required inputs (if applicable) and confirm.

Example workflow with manual dispatch

.github/workflows/testdriver.yaml
name: TestDriver Manual Dispatch

on:
  workflow_dispatch:

jobs:
  test:
    name: Run Tests Manually
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v2

      - name: Run TestDriver
        uses: testdriverai/action@main
        with:
          key: ${{ secrets.TD_API_KEY }}
          prompt: |
            1. Run all tests in the testdriver directory
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FORCE_COLOR: "3"


Run Steps

Benefits of manual dispatch

  • Exploratory Testing: Run tests on demand for specific scenarios.
  • Debugging: Trigger workflows to debug issues without waiting for automated triggers.
  • Flexibility: Test changes in feature branches or experimental setups.

3. GitHub Actions output

TestDriver provides detailed outputs during workflow execution, which are visible in the Actions tab of your repository. These outputs include:

  • Test Summary: A high-level overview of the test results.
  • Logs: Step-by-step logs of the test execution.
  • Screenshots and GIFs: Visual feedback for debugging.
  • Links to TestDriver Dashcam.io Replays: Direct links to detailed test recordings and results.

Example outputs

Test summary

  • ✅ All tests passed.
  • ❌ 2 tests failed.

TestDriver Replay

[View Full Test Results](https://app.testdriver.ai/...)

Using Outputs in Workflows

You can capture and use TestDriver outputs in subsequent steps of your workflow. For example, you can post the test summary as a comment on a pull request.

Example

- name: Post Test Results
  uses: actions/github-script@v6
  with:
    script: |
      const summary = `Test Summary: ${process.env.TEST_SUMMARY}`;
      github.rest.issues.createComment({
        issue_number: context.issue.number,
        owner: context.repo.owner,
        repo: context.repo.repo,
        body: summary,
      });
  env:
    TEST_SUMMARY: ${{ steps.testdriver.outputs.summary }}


Summary of Features

  1. Branch Creation: Automatically create branches for test results or auto-healed tests.
  2. Manual Dispatch: Trigger workflows on demand from the GitHub Actions UI.
  3. Detailed Outputs: Access logs, summaries, and visual feedback directly in the Actions tab.

These features make TestDriver a powerful tool for managing automated testing workflows in GitHub, enabling better collaboration, debugging, and test management.