How do you run TestGen from Azure Data Factory?

You run DataOps TestGen from Azure Data Factory with Web activities that call the TestGen REST API: one starts the test run after the Copy activity, an Until loop polls the job, a third reads the result counts, and an If Condition sends failed tests to a Fail activity before the downstream notebook runs. No connector is needed.

Key points

  • DataOps TestGen runs from Azure Data Factory through Web activities calling its REST API: POST /api/v1/test-suites/{test_suite_id}/test-runs, then GET /api/v1/jobs/{job_id} in an Until loop, then GET /api/v1/test-runs/{job_id}.
  • Microsoft's docs (checked October 2026) say a Web activity times out after 1 minute without a response; TestGen answers a submission at once with 202 Accepted and a job ID, so the Until loop does the waiting.
  • An If Condition on the failed and error counts routes a bad run to ADF's Fail activity, which ends the pipeline with a custom error message and code before the downstream notebook runs.
  • DataOps Observability has a documented Azure Data Factory agent that reads ADF events through Azure Event Hubs; the docs mark access to its private Docker repository as Enterprise.

Data Factory tells you the copy succeeded and how many rows it moved. It has no opinion on whether the customer key in those rows is null. Put DataOps TestGen between the copy and the notebook that reads it.

TestGen runs from Data Factory through Web activities that call its REST API. No connector, and none needed. The Airflow answer and the CI/CD answer cover the same calls in other tools. For what TestGen tests in the database itself, see the Synapse and Fabric and OneLake answers.

The pipeline

Copy, test, then transform. The endpoints come from Run Profiling and Tests:

ActivityWhat it does
Copy dataLoads the table
Web: start runPOST /api/v1/test-suites/{test_suite_id}/test-runs, returns a job id
UntilWait 15 seconds, then Web GET /api/v1/jobs/{job_id}; exit when status is completed, error, or canceled
Web: read resultGET /api/v1/test-runs/{job_id}, returns result.result_counts and result.score
If ConditionFailed or error count above zero goes to Fail; otherwise on to the notebook
NotebookRuns only when the data passed

The start activity, with turnOffAsync set so ADF returns the job ID instead of chasing the 202:

{
  "name": "Start TestGen run",
  "type": "WebActivity",
  "typeProperties": {
    "method": "POST",
    "url": "@concat(pipeline().parameters.testgenApi, '/api/v1/test-suites/', pipeline().parameters.suiteId, '/test-runs')",
    "headers": { "Authorization": "@concat('Bearer ', variables('tgToken'))", "Content-Type": "application/json" },
    "body": "{\"metadata\": {\"system\": \"Azure Data Factory\", \"run_id\": \"@{pipeline().RunId}\"}}",
    "turnOffAsync": true
  }
}

The If Condition expression on the read-result activity:

@greater(add(activity('Read TestGen result').output.result.result_counts.failed,
             activity('Read TestGen result').output.result.result_counts.error), 0)

Its true branch is a Fail activity, which ends the pipeline with an error message and code you choose. The notebook never starts. That’s the tripwire pattern DataKitchen’s OneLake post describes for Data Factory and Fabric pipelines.

Three ADF details that bite

The Web activity times out after 1 minute with no response, up to 10 with httpRequestTimeout. That’s why the start call returns at once and the Until activity waits instead. Give the Until a timeout too. Microsoft’s docs (checked October 2026) say an inner activity’s failure doesn’t stop the loop.

Warnings don’t block. A TestGen test set to warn returns warning, not failed, per the testing docs. The expression above ignores them on purpose.

Tokens. Open source authenticates with an OAuth 2.1 client: a first Web activity posts the stored refresh token to /oauth/token with the client ID and secret as Basic authentication and gets a one-hour access token. A refresh token lasts 30 days, then someone signs in through the browser to issue a new one. Enterprise adds personal access tokens. Keep either in Azure Key Vault, not in the pipeline JSON.

Where results land

In TestGen. The Test Results page shows every result, and the metadata you sent appears under Run details, so a failed test carries the ADF run ID. The optional body also takes an external_url, shown under Link, if you want a clickable path back to the run.

DataOps Observability has a documented Azure Data Factory agent. It reads ADF events from Azure Event Hubs, fed by diagnostic settings, and puts pipeline runs on the same timeline as TestGen results exported to Observability. The docs mark access to the agent’s private Docker repository as Enterprise. DataKitchen’s nineteen Microsoft features post maps what Data Factory, Purview, and Fabric check on their own, and the Fabric tool comparison weighs the alternatives. The supported sources list covers what TestGen tests once the copy lands.

The core profiling, testing, and monitoring engine is free and open source. Enterprise adds team access, security, Commercial Pharma tests, source-data controls for AI, and support.

Documentation: TestGen API, Run Profiling and Tests, API Authentication, OAuth 2.1 Clients, Connect to Observability, Observability Azure Data Factory agent, Add Azure Diagnostic Settings

Frequently asked questions

Short answers to the follow-up questions people ask next.

Is there an Azure Data Factory connector for TestGen?

No, and none is needed. Azure Data Factory's Web activity calls the DataOps TestGen REST API directly: POST /api/v1/test-suites/{test_suite_id}/test-runs to start a run, GET /api/v1/jobs/{job_id} to poll, and GET /api/v1/test-runs/{job_id} for the counts. TestGen connects to the databases ADF loads, such as Azure SQL Database, Azure Synapse, and Microsoft OneLake.

Why does my Web activity time out waiting for TestGen?

It shouldn't wait. Microsoft's docs say an Azure Data Factory Web activity times out after 1 minute without a response, extendable to 10 minutes. DataOps TestGen returns 202 Accepted with a job ID as soon as you submit a run, and an Until loop polls GET /api/v1/jobs/{job_id}. Set turnOffAsync to true so ADF doesn't try its own 202 polling.

Does DataOps Observability monitor Azure Data Factory?

Yes. DataKitchen documents a DataOps Observability agent for Azure Data Factory that reads pipeline events from Azure Event Hubs, fed by ADF diagnostic settings. One agent listens to one Event Hubs instance. The docs mark access to the agent's private Docker repository as Enterprise. TestGen results join the same view through TestGen's export to Observability.

Does any data leave my environment when Data Factory runs TestGen?

No. DataOps TestGen runs its profiling and tests as read-only SQL inside your database and stores only computed results, such as aggregates, statistics, and test outcomes, in its own application database on your infrastructure. Profiling keeps each column's most frequent values for display. The Web activities receive IDs, counts, and a score, never table rows.

Try it on your own data

DataOps TestGen is free and open source. Profile a table and generate its tests this afternoon.