Skip to main content
Trigger a test run from your pipeline after each deployment, so every build is tested against the environment it deployed to. The run report links back to the commit and branch that triggered it.

Before you begin

Create a project API key under Settings → API keys, and store it as a secret named EMPIRICALRUN_KEY in your CI provider. Every method on this page uses it.

GitHub Actions

With GitHub Actions, add the dispatch action after your deploy step:
v1 receives backwards-compatible fixes, and breaking changes ship as a new major version. To pin an exact release, use a tag such as v1.0.0. Use the environment-variables input to set environment variables for the test run, one per line in NAME: value format. These override the environment’s configured variables. The URL of the build under test is passed to tests as the BUILD_URL environment variable. Set group and on-conflict in the concurrency input to control what happens when the group already has an active run. For preview deployments, a group such as preview/acme/web@${{ github.head_ref }} with cancel lets a new push supersede the previous run for that branch. For production, use an environment/repository group with wait to prevent deployments from testing concurrently. See Concurrency.
The build-url input is deprecated. Set BUILD_URL with environment-variables. See Deprecations.

Vercel deployments

For Vercel deployments, trigger tests on the deployment_status event. You can copy this workflow into .github/workflows/trigger-e2e.yaml:
The GITHUB_TOKEN environment variable lets the action pull branch info for the deployment, which is attached to the test run report.

Other providers

With any other CI/CD provider, trigger a run with the Trigger a test run API.

Minimal snippet

Metadata for reporting

Add build details and metadata to show them on the run report:
  • build: the repository, commit and branch that triggered the run
  • metadata: any other key-value pairs
  • environment_variables_overrides: variables for this run, such as BUILD_URL

Pull request runs

For a pre-merge run on an application pull request, send trigger with the pull request. The run uses the matching test branch, merged into the default branch. See Branching.
The dispatch-action sends trigger automatically on pull_request workflow events.

Concurrency

Tell Empirical what to do when a run for the same thing is already going. Runs that share a concurrency.group (within the project) execute one at a time; on_conflict is what the new run does when the group is busy. See Concurrency.
A new push to the same branch cancels the run still going for the previous push. Use "on_conflict": "wait" to queue behind it instead, or the deployment URL as the group when one server can only take one run at a time.

Reporters

Choose which reporters a run posts to with reporters. Leave it out to use the environment’s reporters. This posts the GitHub check and PR comment for a pull request build, but no Slack message:
Add { reporter_type: "slack_run_status", slack_channels: ["C0123456789"] } to also post to a Slack channel. Use the List reporters API to find your channel ids and the repositories the GitHub Reporter covers. See Report notifications.