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.


echo "[$(date)] Start a new execution for existing trigger"
execution_id=$(curl -X POST --silent | jq -r ".id")

echo "[$(date)] Waiting for execution to complete (view online at$execution_id)"
while [ $(curl -H "X-Testable-Key:$API_KEY" --silent$execution_id | jq -r ".completed") = "false" ]; do
  echo -n "."
  sleep 5

epoch=$(date +"%s")
echo "[$(date)] Storing CSV results at results-$epoch.csv"
curl -H "X-Testable-Key:$API_KEY" --silent$execution_id/results.csv > results-$epoch.csv