This guide shows how to run Leapwork Performance tests from a CI/CD pipeline, wait for the result, and collect reports for later review.
What You Can Automate
A typical pipeline integration follows this sequence:
-
Submit a performance test run to Leapwork Performance.
-
Capture the
runIdand polling URL from the API response. -
Poll the run status until the run is complete.
-
Download the generated reports.
-
Mark the pipeline as passed or failed based on the result.
Integration Flow
CI/CD pipeline starts
-> Call Leapwork Performance run API
-> Receive runId and poll URL
-> Poll status until Finished, Failed, or Stopped
-> Download reports
-> Pass or fail the pipeline
Prerequisites
Before you build the integration, make sure you have:
-
Access to a Leapwork Performance environment.
-
An API key with permission to start and read integration runs.
-
The asset IDs or names required for the test you want to execute.
-
A CI/CD agent that can make outbound HTTPS calls to the Leapwork Performance API.
-
Permission in your pipeline environment to store secrets securely.
Authentication
Use an API key when calling Leapwork Performance from your pipeline. Store the key in your CI/CD secret store and inject it into the job at runtime.
Example header:
Authorization: X-API-KEY <your-api-key>
Step 1: Start a Test Run
Submit a request to the run endpoint.
POST /api/integration/runIntegration
Content-Type: application/json
Authorization: X-API-KEY <your-api-key>
Example request body:
{
"timelineAssetId": "<timeline-asset-id>",
"timelineName": "Smoke baseline",
"projectId": "<project-id>",
"dataItemAssetId": "<data-item-asset-id>",
"dataItemName": "Checkout workload",
"role": "loadUser",
"userCount": 50,
"trackItems": []
}
A successful response returns identifiers and a URL you can use for polling.
Example response fields:
{
"timelineId": "<timeline-id>",
"runId": "<run-id>",
"status": "Preparing",
"plannedRunTime": "00:10:00",
"estimatedVum": 12,
"trackItems": [],
"pollResultUrl": "https://<your-environment>/getTimelineStatus?runId=<run-id>"
}
Step 2: Poll for Completion
Poll the status endpoint until the run reaches a terminal state.
During execution you may see statuses such as:
-
Authenticating -
Preparing -
Running
Terminal states are:
-
Finished -
Failed -
Stopped
Your pipeline should keep polling while the run is still active, then stop when it reaches a terminal state.
Step 3: Download Reports
When the run is complete, download the report URLs returned by the API response.
Typical outputs include:
-
Excel report
-
AI analysis report
These can be published as pipeline artifacts so teams can review them after the build.
Optional: Stop a Run Early
If your pipeline times out or you need to cancel the execution, call the stop endpoint with the runId.
GET /api/integration/stopIntegration?runId=<run-id>
Authorization: X-API-KEY <your-api-key>
Azure DevOps Example
The Azure DevOps pattern is usually:
-
Store the API key as a secret pipeline variable.
-
Run a script step to submit the test run.
-
Parse the response and save the
runIdandpollResultUrl. -
Run a second script step to poll until completion.
-
Publish the downloaded reports as build artifacts.
Example pipeline shape:
trigger:
- main
pool:
vmImage: windows-latest
variables:
LEAPWORK_PERFORMANCE_BASE_URL: 'https://<your-environment>'
LEAPWORK_PERFORMANCE_TIMELINE_ID: ''
LEAPWORK_PERFORMANCE_TIMELINE_NAME: 'Smoke baseline'
LEAPWORK_PERFORMANCE_PROJECT_ID: ''
LEAPWORK_PERFORMANCE_DATA_ITEM_ASSET_ID: ''
LEAPWORK_PERFORMANCE_DATA_ITEM_NAME: 'Checkout workload'
LEAPWORK_PERFORMANCE_ROLE: 'loadUser'
LEAPWORK_PERFORMANCE_USER_COUNT: '50'
steps:
- checkout: self
- powershell: |
./azure-devops/run-integration.ps1 `
-BaseUrl "$(LEAPWORK_PERFORMANCE_BASE_URL)" `
-ApiKey "$(LEAPWORK_PERFORMANCE_API_KEY)" `
-TimelineId "$(LEAPWORK_PERFORMANCE_TIMELINE_ID)" `
-TimelineName "$(LEAPWORK_PERFORMANCE_TIMELINE_NAME)" `
-ProjectId "$(LEAPWORK_PERFORMANCE_PROJECT_ID)" `
-DataItemAssetId "$(LEAPWORK_PERFORMANCE_DATA_ITEM_ASSET_ID)" `
-DataItemName "$(LEAPWORK_PERFORMANCE_DATA_ITEM_NAME)" `
-Role "$(LEAPWORK_PERFORMANCE_ROLE)" `
-UserCount "$(LEAPWORK_PERFORMANCE_USER_COUNT)"
displayName: Start Leapwork Performance run
- powershell: |
./azure-devops/poll-integration-status.ps1 `
-BaseUrl "$(LEAPWORK_PERFORMANCE_BASE_URL)" `
-ApiKey "$(LEAPWORK_PERFORMANCE_API_KEY)" `
-RunId "$(RunId)" `
-TrackItemIds "$(TrackItemIds)" `
-TrackItemNames "$(TrackItemNames)" `
-PollResultUrl "$(PollResultUrl)" `
-ExpectedRunTime "$(ExpectedRunTime)"
displayName: Wait for Leapwork Performance result
- task: PublishBuildArtifacts@1
displayName: Publish Leapwork Performance reports
condition: always()
inputs:
PathtoPublish: reports
ArtifactName: leapwork-performance-reports
Jenkins Example
The Jenkins pattern is similar:
-
Store the API key in Jenkins credentials.
-
Load the credential into the pipeline environment.
-
Run a script to start the test.
-
Poll until completion.
-
Archive the downloaded reports.
Example pipeline shape:
pipeline {
agent any
environment {
LEAPWORK_PERFORMANCE_BASE_URL = 'https://<your-environment>'
LEAPWORK_PERFORMANCE_TIMELINE_ID = ''
LEAPWORK_PERFORMANCE_TIMELINE_NAME = 'Smoke baseline'
LEAPWORK_PERFORMANCE_PROJECT_ID = ''
LEAPWORK_PERFORMANCE_DATA_ITEM_ASSET_ID = ''
LEAPWORK_PERFORMANCE_DATA_ITEM_NAME = 'Checkout workload'
LEAPWORK_PERFORMANCE_ROLE = 'loadUser'
LEAPWORK_PERFORMANCE_USER_COUNT = '50'
}
stages {
stage('Start Leapwork Performance run') {
steps {
withCredentials([string(credentialsId: 'leapwork-performance-api-key', variable: 'LEAPWORK_PERFORMANCE_API_KEY')]) {
powershell '''
.\\run-integration.ps1 `
-BaseUrl "$env:LEAPWORK_PERFORMANCE_BASE_URL" `
-ApiKey "$env:LEAPWORK_PERFORMANCE_API_KEY" `
-TimelineId "$env:LEAPWORK_PERFORMANCE_TIMELINE_ID" `
-TimelineName "$env:LEAPWORK_PERFORMANCE_TIMELINE_NAME" `
-ProjectId "$env:LEAPWORK_PERFORMANCE_PROJECT_ID" `
-DataItemAssetId "$env:LEAPWORK_PERFORMANCE_DATA_ITEM_ASSET_ID" `
-DataItemName "$env:LEAPWORK_PERFORMANCE_DATA_ITEM_NAME" `
-Role "$env:LEAPWORK_PERFORMANCE_ROLE" `
-UserCount "$env:LEAPWORK_PERFORMANCE_USER_COUNT"
'''
}
}
}
stage('Wait for result') {
steps {
withCredentials([string(credentialsId: 'leapwork-performance-api-key', variable: 'LEAPWORK_PERFORMANCE_API_KEY')]) {
powershell '''
$runOutput = Get-Content .\\run-output.json | ConvertFrom-Json
.\\poll-integration-status.ps1 `
-BaseUrl "$env:LEAPWORK_PERFORMANCE_BASE_URL" `
-ApiKey "$env:LEAPWORK_PERFORMANCE_API_KEY" `
-RunId "$($runOutput.RunId)" `
-TrackItemIds "$($runOutput.TrackItemIds)" `
-TrackItemNames "$($runOutput.TrackItemNames)" `
-PollResultUrl "$($runOutput.PollResultUrl)" `
-ExpectedRunTime "$($runOutput.ExpectedRunTime)"
'''
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'reports/**', fingerprint: true, allowEmptyArchive: true
}
}
}
Attachments
Please open each link, copy the full file content, paste it into a local file, and save it with the original filename. Included attachments:
-
azure-pipelines.yml- azure-pipelines.yml -
run-integration.ps1- run-integration.ps1 -
poll-integration-status.ps1- poll-integration-status.ps1 -
Jenkinsfile-Jenkinsfile -
README.txt- README.txt
Validation Checklist
After setup, confirm that your pipeline can:
-
Authenticate successfully with the API key.
-
Start a new performance run.
-
Poll until the run reaches a terminal state.
-
Download the expected reports.
-
Fail the build when the run result is unsuccessful.
Troubleshooting
If the integration does not work as expected, check the following first:
-
The base URL points to the correct Leapwork Performance environment.
-
The API key is valid and passed in the required header.
-
Required IDs in the request payload belong to assets that exist in your environment.
-
The build agent can reach the API endpoints over the network.
-
The polling logic stops only on terminal statuses.