How to send requests to AppLoader using Jenkins?

This article will walk you through the format and syntax used when making requests to AppLoader using Jenkins. The easiest way to send requests is by using the Jenkins HTTP Request plugin. This plugin sends an HTTP/HTTPS request to a URL with some parameters. Basically it executes a request to a URL with the build parameters. To learn more, see here.

Using HTTP Request Plugin in Jenkins

If the plugin isn't installed in your Jenkins, you can download and install it by following the steps here

Once you are done with the installation, go to Jenkins -> Manage Jenkins -> Configure System and fill out the "HTTP Request" section by providing a unique keyname, username, and password.

Now, the Jenkins is ready to send the requests. In this article, we will create a pipeline (Jenkins job) for each request and then run the pipelines by adding them to the Jenkins build queue.

AppLoader requests using Jenkins

Start rUsers

Go to Jenkins Dashboard and click "New Item".

Enter a name for the item, select "Pipeline" and click "OK". i.e. Start rUsers

Put a description for the pipeline and put the script below in the Script section of the Pipeline.

Click "Apply" and "Save".

This takes the starting users parameters as inputs and starts the rUsers in the specified Injector. 

Script:

def response = httpRequest "http://IP Address:port number/main/remote.php?type=startinjvu&id=[Injector ID]&ind=[Start Index]&del=[Launch Delay]&ruser=[Number of Users]"
println('Status: '+response.status)
println('Response: '+response.content)

Example:

def response = httpRequest "http://172.169.12.52:8888/main/remote.php?type=startinjvu&id=8&ind=1&del=10&ruser=100"
println('Status: '+response.status)
println('Response: '+response.content)

Response:

"Start rUsers command was successfully sent."

Tip: You can find the Start rUsers URL by selecting the desired Injector from the "Injectors" section and clicking on the Link icon on the "Start rUsers" form. 

Run a Test 

To create a new pipeline for the next request, go back to Jenkins Dashboard and click "New Item".

Enter a name for the item, select "Pipeline" and click "OK". i.e. Run Load Tests

Put a description for the pipeline.

Next, check "Build after other projects are built" option from the "Build Triggers" section and type the name of the project for starting rUsers. i.e. Start rUsers

Then, select "Quite Period" and enter a wait time so Jenkins will wait for the specified period of time (in seconds) before actually starting the build. (The wait time can be set depending on the "Launch Delay" value for starting rUsers.)

Lastly, put the script below in the Script section of the Pipeline.

Click "Apply" and "Save".

This takes the Test plan name and Test plan ID as inputs and then it starts the execution of the test.

Script:

def response = httpRequest "http://IP Address:port number/main/remote.php?type=execlt&alias=[Test Plan Name]&tid=[Test Plan ID]&testname="
println('Status: '+response.status)
println('Response: '+response.content)

Example:

def response = httpRequest "http://172.169.12.52:8888/main/remote.php?type=execlt&alias=Citrix_Test&tid=69&testname="
println('Status: '+response.status)
println('Response: '+response.content)

Response:

"Execute Load Test command was successfully sent."

Tip: You can find the Run Test URL by selecting the desired Test plan from the "Manage Tests" section and clicking on the Test Link icon via the "Run" drop-down menu. 

End a Test 

The End Test request can be created if you want to stop the test execution manually.

To create a new pipeline for this request, go back to Jenkins Dashboard and click "New Item".

Enter a name for the item, select "Pipeline" and click "OK". i.e. End Load Tests

Put a description for the pipeline.

Next, check "Build after other projects are built" option from the "Build Triggers" section and type the name of the project for running a test. i.e. Run Load Tests

Then, select "Quite Period" and enter a wait time so Jenkins will wait for the specified period of time (in seconds) before actually starting the build. (The wait time can be set depending on when you need to end the test after starting it. )

Lastly, put the script below in the Script section of the Pipeline.

Click "Apply" and "Save".

This sends the stop command to the Injectors and then rUsers to end the execution of the test.

Script:

def response = httpRequest "http://IP Address:port number/main/remote.php?type=endtest&actiontype=endtest"
println('Status: '+response.status)
println('Response: '+response.content)

Example:

def response = httpRequest "http://172.169.12.52:8888/main/remote.php?type=endtest&actiontype=endtest"
println('Status: '+response.status)
println('Response: '+response.content)

Response:

"End Loadtest command was successfully sent."

When you create your pipelines, there will be three pipelines listed in your Jenkins view. Now you can start running your jobs by building your first pipeline (i.e. Start rUsers); the next pipelines will move to the build queue and will be run sequentially.

Note: You can use any other methods to configure your Jenkins jobs and run them.