How to run GenRocket Scenarios via Jenkins
This article will lead you through the steps of integrating GenRocket Scenarios into your Jenkins Continuous Integration (CI) pipeline. This article assumes you already have your Jenkins Server setup.
Note: This article provides step-by-step instructions for Mac OS/Linux. To learn how to run GenRocket Scenarios via Jenkins for Windows, please see Windows: How Do I Run GenRocket Scenarios via Jenkins?.
In This Article
- Step 1 - Download and Install the GenRocket Runtime on Jenkins Server
- Step 2 - Set the GenRocket Environment Variables in Jenkins
- Step 3 - Add the Jenkins Server to the GenRocket Web Platform
- Step 4 - Update Resource Variables with the Appropriate Values
- Step 5 - Download your ServerProfile.grp File
- Step 6 - Run the genrocket -a Command to Update Generator and Receiver Jars
- Step 7 - Create a Jenkins Job to run GenRocket Scenarios
- Step 8 - Navigate to the Build Tab for the Jenkins Job
- Step 9 - Select the Execute Shell Option for the Build
- Step 10 - Add the Following Script to Run the Scenario
- Step 11 - Run your Jenkins Job and View Output
Step 1 - Download and Install the GenRocket Runtime on Jenkins Server
The GenRocket Runtime consists of a set of Jars that can be loaded and executed by a Java Virtual Machine (JVM) to load and run GenRocket Scenarios on your Jenkins Server.
This step is identical to downloading and installing the GenRocket Runtime onto your local computer. If you have not already performed this step, please refer to the page below:
Step 2 - Set the GenRocket Environment Variables in Jenkins
You will need to set the Environment Variable GEN_ROCKET_HOME to the path where you have downloaded the GenRocket Runtime on your Jenkins Server and then update the PATH variable.
Step 2a - Access the Configure System Form in Jenkins
- Click on Manage Jenkins in the left sidebar.
- Next, click on Configure System underneath Manage Jenkins.
Step 2b - Add and Update Environment Variables in Jenkins
- Scroll down to the Environment Variables section of the Configure System form to add/update your environment variables.
- Set the environment variable GEN_ROCKET_HOME to the path where you have downloaded the GenRocket Runtime.
- Set or update the environment variable PATH value to $GEN_ROCKET_HOME/bin directory so that the Jenkins shell can recognize the genrocket command as a GenRocket Runtime command.
Step 3 - Add the Jenkins Server to the GenRocket Web Platform
If you have not already done so, log into the GenRocket Web Platform and add the Jenkins Server to GenRocket from the My Organization page. To see step-by-step instructions, click here.
Once added, an Org Admin can download the Server Profile so that the Server may be used to execute GenRocket Scenarios.
- Select the Servers tab and then click New Server.
- Add a unique Name, Description (optional), and Email ID (Optional).
Step 4 - Update Resource Variables with the Appropriate Values
Next, you will need to update resource variables within the GenRocket Web Platform with the appropriate values with respect to Jenkins Server.
These steps will need to be followed for each resource that is needed for the Jenkins Server.
- In the Resources pane, select the Jenkins Server within the Select Server drop-down menu.
- Click on the Pencil to enter the output directory path for the Jenkins Server in the Resources Pane.
- Click Save once finished.
Step 5 - Download your ServerProfile.grp File
- Expand the Download drop-down menu in the Resources Pane.
- Select Download ServerProfile.grp to download your server profile.
- Place the ServerProfile.grp file in the .genrocket folder of your Jenkins server.
Step 6 - Run the genrocket -a Command to Update Generator and Receiver Jars
- Open your terminal or command line application on the Jenkins Server.
- Run the genrocket -a command to update Generator and Receiver Jars.
Step 7 - Create a Jenkins Job to run GenRocket Scenarios
- Open Jenkins and create a new job by clicking on New Item in the left sidebar.
- Add an item name for the new job.
- Select Freestyle project.
- Click OK at the bottom of the form.
Step 8 - Navigate to the Build Tab for the Jenkins Job
- You will now be on the Configuration page for the new job.
- Click on the Build Tab to select it and make configuration changes.
Step 9 - Select the Execute Shell Option for the Build
- Scroll down in the Build Tab.
- Then click on Add Build Step to select the Execute Shell option from the drop-down menu in the Build section.
Step 10 - Add the Following Script to Run the Scenario
The script below will execute the scenarios in $HOME/scenarios folder.
#!/bin/bash cd ~/scenarios genrocket -r UserScenario.grs
Note: This example assumes you have a UserScenario.grs in this folder. You can modify this script to run your Scenarios.
This script will need to be added in the Command text field on the Build Tab, as shown below:
Step 11 - Run your Jenkins Job and View Output
You can now run GenRocket Scenarios via Jenkins.
- Run the build for the job.
- Then view your Console Output.