Skip to main content

Pipeline Integration

You can integrate the execution of msg.ZenTestAI into your CI/CD pipeline. This allows you to automatically test your application after each deployment. You can directly execute Test-Sets via API via the REST interface.

Please see below bash script example to execute a Test-Set via API. You can get the test-set id from the URL when opening the test-set id in the browser.

tip

Currently there are no native plugins for CI/CD tools like Jenkins, GitLab, or GitHub Actions. However, you can use the REST API to integrate msg.ZenTestAI into your CI/CD pipeline. Native tools are planned for the future. If you have a specific request, please contact us via hello@zentest.ai

sudo apt-get install -y jq

# grab an access token from your relevant identity provider

# create a new run with test-set id: 1
response_start=$(curl -s -X POST https://zentest.ai/product/FLEXAPP/test-sets/1/run-test-set \
-H "Authorization: Bearer $access_token" )

# grab the test execution id based on the response
test_id=$(echo $response_start | jq -r '.id')

echo "Test-Execution-run: $test_id (url: https://zentest.ai/executions/display/$test_id )"

status_endpoint="https://zentest.ai/test-executions/execution/$test_id"

# Poll the status endpoint every second
while true; do
status_response=$(curl -s -H "Authorization: Bearer $access_token" $status_endpoint)

status=$(echo $status_response | jq -r '.status')

echo "Current status: $status"

if [ "$status" == "FAILED" ]; then
echo "Test run failed"
echo $status_response
exit 1
elif [ "$status" == "PASSED" ]; then
echo "Test run passed"
break
elif [ "$status" == "CANCELED" ]; then
echo "Test run canceled"
exit 1
elif [ "$status" == "null" ]; then
echo "Test run id unknown"
echo $status_response
exit 1
else
echo "Test is still running"
fi

# Wait for 1 second before checking again
sleep 1
done