CI Lifecycle Using Our API
In this example we start a test execution, wait for it to finish, and then save all results in CSV format.
It assumes you have already created a test configuration and scenario via the API or website first and have the trigger URL for the configuration available. See the concepts, new configuration guide, new scenario guide, configuration API, and scenario API for more details.
A trigger URL is required in the first API call below.
#!/bin/bash echo "[$(date)] Start a new execution for existing trigger" execution_id=$(curl -X POST --silent https://api.testable.io/public/lcjsdlijvx | jq -r ".id") echo "[$(date)] Waiting for execution to complete (view online at https://a.testable.io/results/$execution_id)" while [ $(curl -H "X-Testable-Key:$API_KEY" --silent https://api.testable.io/executions/$execution_id | jq -r ".completed") = "false" ]; do echo -n "." sleep 5 done epoch=$(date +"%s") echo "[$(date)] Storing CSV results at results-$epoch.csv" curl -H "X-Testable-Key:$API_KEY" --silent https://api.testable.io/executions/$execution_id/results.csv > results-$epoch.csv