Triggering a schedule

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.

A schedule can be triggered to execute using the REST API.

In the following example, we’ll use the REST API to first find, then trigger and finally poll to get the results from a schedule. This is somewhat technical, and in order to follow along you will need some experience with http, json and command-line environments.

In this example, we’ll use a controller installed on the local computer (localhost) on port 9000 and assume that a schedule called “test” has already been created.

Note: The REST API can be explored using real-time calls by going to this url in a browser: http://localhost:9000/help/index

Step 1: Open a command-line environment such as PowerShell in Windows, Terminal in OSX or eg. bash in Linux.

Step 2: On the command line, make an http request to the controller to get all schedules on the Controller.

Using curl:

Using PowerShell:

If you have performed the http request correctly, the response code will be 200 (OK) and the response body will be a json string that looks something like this:

Step 3: Identify the “Id” of the schedule.

The json contains a lot of information about the schedule, including the full history of previous runs. However, for this example all we need is the “Id”, which in this example is “985d358a-358c-477e-bbb6-884cf02ca159”.

Step 4: Make an http request to run the schedule now.

Using curl:

Using Powershell:

The response code should be 204 (No Content) and if you open Studio and look under “Scheduling”, the schedule should already be queued for execution.

Read more about how to integrate Leaptest with third-party systems and learn how to use the results of a scheduled run in a real-life scenario.