Run the tests your release depends on as a step in the release pipeline, and stop the release when they fail. TestGen runs from the CI system through its REST API; there’s no connector to install, and you don’t need one. How do you test data before a release covers what to test. This page covers the wiring, for any of the 14 databases TestGen supports.
One script, four documented calls
Everything below comes from TestGen’s Run Profiling and Tests and OAuth Clients pages. Register an OAuth client once, store the refresh token as a CI secret, and save this as scripts/testgen-gate.sh. It needs curl and jq.
#!/usr/bin/env bash
set -euo pipefail
# 1. Trade the stored refresh token for a one-hour access token
TOKEN=$(curl -sf -X POST "$TG_URL/oauth/token" -u "$TG_CLIENT_ID:$TG_CLIENT_SECRET" \
-d grant_type=refresh_token -d refresh_token="$TG_REFRESH_TOKEN" | jq -r .access_token)
AUTH="Authorization: Bearer $TOKEN"
# 2. Start the test run, linked back to this CI job
JOB=$(curl -sf -X POST "$TG_URL/api/v1/test-suites/$TG_SUITE_ID/test-runs" -H "$AUTH" \
-H "Content-Type: application/json" -d "{\"external_url\": \"$CI_RUN_URL\"}" | jq -r .id)
# 3. Poll until completed, error, or canceled, for up to 30 minutes
for i in $(seq 1 180); do
STATUS=$(curl -sf "$TG_URL/api/v1/jobs/$JOB" -H "$AUTH" | jq -r .status)
case "$STATUS" in completed|error|canceled) break ;; esac
sleep 10
done
[ "$STATUS" = completed ] || { echo "TestGen run ended as: $STATUS"; exit 1; }
# 4. Block on failures and errors; report warnings
COUNTS=$(curl -sf "$TG_URL/api/v1/test-runs/$JOB" -H "$AUTH" | jq .result.result_counts)
echo "TestGen results: $COUNTS"
[ "$(echo "$COUNTS" | jq '.failed + .error')" -eq 0 ]
TG_URL is the TestGen API URL, port 8530 by default, not the UI URL. Open-source TestGen authenticates the API this way, with an OAuth 2.1 client: access tokens last one hour, and refresh tokens last 30 days, so re-run the one-time setup, browser sign-in included, before yours expires. Enterprise users can use a personal access token instead.
GitHub Actions, GitLab CI, Azure DevOps
Each system calls the same script after the build step. Keep the token and client secret in its secret store: GitHub secrets, GitLab CI/CD variables, or Azure Pipelines secret variables.
# GitHub Actions: a step in the release job
- name: TestGen gate
run: scripts/testgen-gate.sh
env:
TG_URL: ${{ vars.TG_URL }}
TG_SUITE_ID: ${{ vars.TG_SUITE_ID }}
TG_CLIENT_ID: ${{ secrets.TG_CLIENT_ID }}
TG_CLIENT_SECRET: ${{ secrets.TG_CLIENT_SECRET }}
TG_REFRESH_TOKEN: ${{ secrets.TG_REFRESH_TOKEN }}
CI_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# GitLab CI: a job in the test stage (TG_* set as masked CI/CD variables)
testgen_gate:
stage: test
script:
- CI_RUN_URL="$CI_JOB_URL" scripts/testgen-gate.sh
# Azure DevOps: a script step (secrets mapped into env explicitly)
- script: scripts/testgen-gate.sh
displayName: TestGen gate
env:
TG_CLIENT_SECRET: $(TG_CLIENT_SECRET)
TG_REFRESH_TOKEN: $(TG_REFRESH_TOKEN)
CI_RUN_URL: $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)
A non-zero exit fails the step in all three, and the release stops.
Blocking tests and warning tests
Every TestGen test definition carries a severity. The run summary counts failed and warning results separately, so the script blocks on the first and prints the second. Block on what breaks the release: row counts, keys, the business rules a dashboard depends on. Leave a slow trend you want a person to look at as Warning. The team in DataKitchen’s TestGen case study started with production incident checks and is moving toward this kind of pipeline gate. The argument for doing it is older: DataKitchen’s Add DataOps Tests to Deploy with Confidence.
Where results land
The run shows up on TestGen’s Test Results page, with your CI link under Link and Run details. Notifications send it to email, Slack, Microsoft Teams, or any HTTPS webhook, including a Jira automation rule. TestGen also exports results to DataOps Observability as Test Outcomes events. Observability has no CI agent, so the release itself shows up there only if you post events to its API. For orchestrators, see running TestGen from Airflow. For the earlier half of the line, see shift-left testing and Flip the Script.
Documentation: API, API Authentication, Run Profiling and Tests, Onboard a Dataset, Import and Export Tests, OAuth Clients, Notifications, Connect to Observability