Third-Party Integration

Jenkins is a very popular tool to orchestrate and administer build and release pipelines. Test automation is growing into a tool like Jenkins, and the community around Leaptest has build a native Jenkins plugin, that makes it very simple to trigger test cases in Leaptest to run.

This video includes the following:

  • An overview of the integration between Jenkins and Leaptest (click on thumbnail to download overview slide).
     Leaptest Jenkins integration overview
  • Downloading the Leaptest  native Jenkins plugin from the GitHub repository (link: https://github.com/Customatics/)
  • Install the Leaptest plugin on a Jenkins server
  • Create a project and a build definition including the Leaptest plugin as a build step
  • Configure the Leaptest build step and get a brief introduction to schedules in Leaptest
  • Trigger test cases to run on cloud hosted machines from a build in Jenkins.
  • Inspect test results in Jenkins.

The REST API makes it very easy for devops, IT operations and developers to integrate LEAPWORK with any third-party system.

The following is a simple Windows Powershell script that runs a pre-defined LEAPWORK schedule, polls for the results until they are available and then loops through all failed cases and shows how to get the relevant data structures within. The data can then be pushed to any third-party system such as TFS, JIRA or any other Application Lifecycle Management (ALM) system.

Please note that the script contains no error handling or logging mechanisms. It is meant only to demonstrate the core functionality of integrating LEAPWORK with a third-party system.

The script consists of four steps:

Step 1: Get the id of the schedule. This is done by a call to the REST API endpoint /api/v1/runSchedules.

Step 2: Run the schedule now. This is done by a call to /api/v1/runSchedules/{schedule id}/runNow, which will instruct the Controller to queue the schedule for execution as soon as possible.

Step 3: Keep polling for the result every 5 seconds until a new result is returned. This is done by a call to /api/v1/runSchedules/state/{schedule id}, which will return either the last old results or a “busy” result until new results are available.

Step 4: If there are any failed cases, iterate through the failed cases and use the data within to understand what went wrong. This can be very useful if for instance the integration is indended to automatically create new bugs in a bug-tracking system such as JIRA.

Running the script will yield results similar to the following:

You can explore the endpoints mentioned above by going to this url: http://localhost:9000/help/index#!/RunSchedules if you have the Controller installed on your own computer.

If you would like to use the REST API to integrate LEAPWORK with your own systems, feel free to contact prioritysupport@leapwork.com and we’ll do our best to help you get up and running in no time.