QA Wolf logo

QA Wolf

Run Tests on a Deployment

In this tutorial, we'll run tests after a deployment.

Create Trigger

Click the Triggers button in the sidebar of the dashboard.

open triggers from dashboard

Click Create Trigger.

create trigger

You can rename your trigger, or use the default name.

rename trigger

You can choose to run all your tests, or only tests with specific tags.

choose tags

If you have created any environments, choose the one to use when your tests run.

choose environment

Choose Deployment from the Run tests on dropdown.

choose Deployment

You can run your tests on all deployments (preview and production), just preview deployments, or just production deployments.

choose deployment types

To run the tests on specific branches only, choose Select and enter a comma-separated list of branches: develop,main.

For example, at QA Wolf we have a group of tests that we run when staging is deployed. We deploy to staging automatically when we merge to the develop branch.

choose branches

Once you are done, click the Create trigger button to save your trigger.

save trigger

Notify QA Wolf after Deployment

After your deployment succeeds, send us an HTTP POST request. If the deployment matches the filters on this trigger, we will run a test suite.

If you are logged in, your team's API key is included in the example.

curl -H "Authorization: API_KEY_HERE" -H "Content-Type: application/json"

You can optionally provide us the branch, deployment_type, deployment_url, commit SHA or custom one time environment variables.

curl -H "Authorization: API_KEY_HERE" -H "Content-Type: application/json" -d '{"branch": "fixed-login", "deployment_type": "preview", "deployment_url": "", "sha": "de12adda500f2bc5a29dbd89f4fb1b0e1a31de81", "variables": { "custom": "value" }}'

The POST request to the deploy_success webhook includes a few parts:

  • The required Authorization header provides your team's API key: -H "Authorization: API_KEY_HERE".
  • The optional branch string. If a Git commit triggered this deploy, send us the relevant branch so that we can display it in the UI and find any pull requests on the GitHub repo linked to any triggers that match.
  • The optional deployment_type. Send this if you filter by deployment type in the trigger.
  • The optional deployment_url. If you send this, it will be available in your tests as process.env.URL for any runs created by this deployment notification.
  • The optional sha. If a Git commit triggered this deploy, send us the commit SHA so that we can create GitHub commit checks if you have a GitHub repo linked to any triggers that match. We also use this to display a link to the commit in the run UI.
  • The optional variables list. If you send this, it will be injected in the environment used in the suite.

After you run the curl command in your terminal, you'll get a response like this:

"results": [{

Install GitHub App (Optional)

You can connect your GitHub repository to QA Wolf to see status checks on commits.

Connect GitHub Repo

A new tab will open and visit GitHub. You will be asked to choose the repo(s) you want QA Wolf to access.

Install GitHub App

Choose the repo(s) you want to test and click the green Installbutton. After the installation succeeds, the new tab will close.

Confirm the repo you want to test is now selected in the dropdown.

Confirm Selected GitHub Repo

See Results in GitHub

When you push a commit to GitHub, your tests will run after your deployment succeeds.

See results in GitHub

QA Wolf will comment on a pull request with the most recent test suite. As your tests run, the comment is updated to report the latest results.

GitHub pull request comment

View Run History

🎉 Congratulations - now your tests will run when you deploy in 100% parallel!

You can see your test runs in the Run history page of the dashboard.

Run history