QA Wolf logo

QA Wolf

/

Star

2.7k

Run Tests with API

In this tutorial, we'll run our tests by calling the QA Wolf API.

Run Tests by Calling QA Wolf API

The API call below runs all of your tests. 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" https://www.qawolf.com/api/suites

You can optionally filter tests by tags, choose the environment, and provide additional environment variables:

curl -H "Authorization: API_KEY_HERE" -H "Content-Type: application/json" https://www.qawolf.com/api/suites -d '{"tags": "Checkout,Sign up", "environment": "Staging", "variables": { "MY_VARIABLE": "secret" }}'

The API call makes a POST request to the /suites endpoint. It includes a few parts:

  • The required Authorization header provides your team's API key: -H "Authorization: API_KEY_HERE".
  • The optional tags string is a comma separated list of test tag names: "tags": "Checkout,Sign up". If not provided, all of your tests will run. Otherwise, tests with any of the provided tags will run.
  • The optional environment string is the name of the environment to use when running your tests: "environment": "Staging". If you have multiple environments and do not provide an environment, QA Wolf will error and ask you to specify an environment.
  • The optional variables object in the request body provides environment variables to your tests: "variables": { "MY_VARIABLE": "secret" }. If any variables share names with variables in your environment, the passed variables will override those values.

If you paste this command into your terminal and run it, you'll get a response that looks like:

{
"id": "suiteId",
"url": "https://www.qawolf.com/suites/suiteId"
}

The id returned is the id of your new suite. The url links to the results page for your tests.

Get Suite Details by Calling QA Wolf API

If you want to check the status of your suite via API, you can make a GET request to the /suites/:id endpoint. This is useful if you want to take other actions after your suite finishes running.

Include your API key as an Authorization header, and the id of the suite in the URL (:id in the example below):

curl -H "Authorization: API_KEY_HERE" https://www.qawolf.com/api/suites/:id

If you call this endpoint, the response will look like this:

{
"id": "suiteId",
"is_complete": false,
"runs": [
{
"id": "runId",
"status": "created", // can also be 'fail' or 'pass'
"test_name": "My Test"
}
],
"status": "created" // can also be 'fail' or 'pass'
}

View Run History

🎉 Congratulations - now your tests will run when you call the QA Wolf API in 100% parallel!

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

Run history