Leapwork CI/CD Integration: Connecting Visual Tests to Your Pipeline
Leapwork's visual test authoring environment is only half the picture. Tests that run manually on a QA engineer's machine provide limited value compared to tests that run automatically on every build, deployment, or schedule. Getting Leapwork connected to a CI/CD pipeline requires understanding the Scheduling Center, the REST API, and how to handle pass/fail signaling in a way that pipeline tools can act on. This post covers the practical setup.
The Scheduling Center
Leapwork's Scheduling Center is the server-side component that manages test execution. Rather than running tests directly from the Leapwork Studio desktop application, you submit flows to the Scheduling Center, which queues and distributes them to connected agents (machines with the Leapwork agent installed that actually execute the flows).
The Scheduling Center exposes a REST API that external systems — Jenkins, Azure DevOps, GitHub Actions, or any HTTP-capable tool — can call to trigger execution, check run status, and retrieve results. This API is the integration point for CI/CD pipelines.
Before building CI integrations, you need the Scheduling Center deployed and reachable from your CI infrastructure. In on-premise deployments, this typically means a server on your internal network accessible to both your CI agents and your Leapwork execution agents. In cloud deployments, Leapwork's cloud service handles the Scheduling Center.
REST API Basics
The Leapwork REST API provides endpoints for:
- Listing available flows and their IDs
- Starting a scheduled run (triggering execution of one or more flows)
- Polling run status until completion
- Retrieving run results including pass/fail status and per-flow details
A typical CI integration follows this pattern:
- Call the API to start a run, passing the IDs of flows to execute and the target environment configuration
- Poll the run status endpoint at intervals until the run completes or a timeout is reached
- Read the run result to determine pass/fail
- Exit the CI step with a non-zero exit code on failure to gate the pipeline
Leapwork provides an API key for authentication. All API calls require the key as a header. The base URL is your Scheduling Center's address — either your on-premise server or the Leapwork cloud endpoint.
A minimal trigger call looks like:
curl -X POST "https://your-scheduling-center/api/v4/run/runschedulenow" \
-H "AppKey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ScheduleId": "your-schedule-id"}'The response includes a run ID that you use for subsequent status checks. Status polling returns a status field that moves through queued, running, and completed states. On completion, the result field indicates pass or fail.
Jenkins Integration
Leapwork publishes a Jenkins plugin that wraps the REST API calls. With the plugin installed, you add a Leapwork build step to a Jenkins job that takes the Scheduling Center URL, API key, schedule ID, and configuration options (timeout, polling interval).
The plugin handles the polling loop and interprets the result, marking the Jenkins build as unstable or failed based on Leapwork's result. You configure the API key as a Jenkins credential (not a hardcoded value in the pipeline configuration) and reference it by ID.
A Jenkinsfile pipeline step using the plugin looks like:
stage('Run Leapwork Tests') {
steps {
leapwork(
schedulingServiceHostname: 'your-scheduling-center',
schedulingServicePort: 9001,
apiHttps: true,
apiToken: credentials('leapwork-api-key'),
scheduleIds: 'your-schedule-id',
doneStatusAs: 'Success',
failedStatusAs: 'Failure',
errorStatusAs: 'Failure',
timeoutInSeconds: 600
)
}
}If you prefer not to use the plugin (for example, if you're using a minimal Jenkins setup or need more control), you can use shell steps with curl to call the API directly and parse the JSON response with jq to determine the result.
Azure DevOps Integration
Leapwork provides an Azure DevOps extension available from the Azure DevOps marketplace. The extension adds a Leapwork task type to Azure Pipelines. Configuration mirrors the Jenkins plugin: Scheduling Center URL, API key (stored as a pipeline secret variable), schedule ID, and timeout settings.
In a YAML pipeline:
- task: leapwork@1
displayName: 'Run Leapwork Regression Suite'
inputs:
leapworkHostname: 'your-scheduling-center'
leapworkPort: '9001'
leapworkApiToken: '$(LeapworkApiKey)'
scheduleIds: 'your-schedule-id'
timeBetweenCheckInSeconds: '15'
doneStatusAs: 'Success'
failedStatusAs: 'FailedWithIssues'
errorStatusAs: 'Failed'
sendReportByEmail: falseThe task exits with the appropriate status that Azure DevOps interprets for pipeline gating. A failed result marks the pipeline stage as failed, blocking deployment to downstream environments if your pipeline is configured with quality gates.
Test Result Output
Leapwork runs produce results at multiple levels: the overall run (pass/fail), each flow in the run (pass/fail), and each block within a flow (pass/fail with details). The REST API provides access to all levels.
For CI integration, the most important output is the summary result and the per-flow results that identify which flows failed. Leapwork's plugins and task extensions typically write this information to the CI system's console output and, optionally, generate a detailed report.
For test reporting systems that accept JUnit XML (like the Jenkins JUnit plugin or Azure DevOps test results), Leapwork's API can provide run results that you transform to JUnit XML format. The plugins handle this transformation automatically. If you're using the REST API directly, you'll need to build the XML transformation yourself.
Leapwork also provides a web-based report accessible through the Scheduling Center interface, which is more detailed than what fits in a CI console output. In practice, teams typically use CI output for quick pass/fail assessment and the Scheduling Center report for investigation of failures.
Environment-Specific Configurations
Real pipelines deploy to multiple environments: development, staging, and production. Leapwork's environment concept lets you define environment-specific values (base URLs, credentials, environment identifiers) that flows reference through variables. When triggering a run via the API, you specify which environment configuration to use.
This means a single flow can run against development with one set of values and against staging with another, without modifying the flow itself. The environment is a parameter of the run trigger, not a property of the flow.
To set this up: define environments in the Scheduling Center with the appropriate variable values for each. In your CI pipeline, pass the environment ID as a parameter when triggering the run. A Jenkins pipeline deploying to staging triggers Leapwork with the staging environment ID; a deployment to production triggers with the production ID.
Environment credentials (passwords, API keys used by the flows during execution) should be stored as Leapwork environment secrets, not as plaintext variable values. The Leapwork Scheduling Center encrypts secrets at rest and does not expose them in API responses.
Parallel Scheduling
Leapwork supports parallel execution across multiple agent machines. When you trigger a run that includes multiple flows, the Scheduling Center can distribute flows across available agents, reducing total wall-clock time compared to sequential execution.
Parallelism requires multiple Leapwork agent instances registered with the Scheduling Center. Each agent executes one flow at a time. A run with ten flows and five agents can complete in roughly the time of the two slowest flows (assuming balanced flow durations), rather than the sum of all ten.
Scheduling concurrent runs from CI requires care. If two pipeline branches both trigger Leapwork runs simultaneously, and you have limited agents, the second run will queue behind the first. Sizing your agent pool to match expected CI concurrency prevents this from becoming a bottleneck.
Handling Pass/Fail in Pipeline Gates
For Leapwork tests to actually gate deployments, the CI pipeline needs to treat a Leapwork failure as a pipeline failure. With the Jenkins plugin or Azure DevOps extension, this is handled automatically by the task configuration.
With raw API calls, you need to explicitly check the result and exit with a failure code. A shell script approach:
RESULT=$(curl -s -H "AppKey: $API_KEY" \
"https://your-scheduling-center/api/v4/run/$RUN_ID/status")
STATUS=$(echo $RESULT | jq -r '.RunStatus')
if [ "$STATUS" != "Success" ]; then
echo "Leapwork run failed with status: $STATUS"
exit 1
fiThe exit code propagates to the CI system. Jenkins and Azure DevOps both treat non-zero exit codes from shell steps as failures, which stops the pipeline from proceeding to deployment.
Getting CI integration right with Leapwork requires upfront configuration work — Scheduling Center deployment, agent setup, pipeline task configuration, environment definitions — but once in place it runs reliably. The API is stable across Leapwork versions, and the official plugins handle the integration complexity for the two most common CI platforms.