When running your Jenkins automation jobs, you may need to pass some parameters to your scripts. These parameters can be a URL, a browser name, or even the test user’s credentials. This tutorial will walk you through the process of creating a parameterized Jenkins job for Robot Framework.
It is recommended to go through these tutorials, before creating a parameterized Jenkins job:-
Download and install Jenkins on Windows10
Configure JAVA_HOME and MAVEN_HOME
Types of parameters
Jenkins supports several parameter types. Below is a list of the most common ones, but keep in mind that different plugins may add new parameter types:
- String: any combination of characters and numbers
- Choice: a pre-defined set of strings from which a user can pick a value
- Credentials: a pre-defined Jenkins credential
- File: the full path to a file on the filesystem
- Multi-line String: same as String, but allows newline characters
- Password: similar to the Credentials type, but allows us to pass a plain text parameter specific to the job or pipeline
- Run: an absolute URL to a single run of another job
![](https://qaautomation.expert/wp-content/uploads/2022/12/image-1.png?w=305)
Implementation Steps
Step 1: Create a new FreeStyle project
- Give the Name of the project – RobotFramework_Demo.
- Click on the FreeStyle project.
- Click on the OK button.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-131.png?w=913)
Step 2: Description of the project
In the General section, enter the project description in the Description box.
Check the option – This project is parameterized.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-116.png?w=1200)
Click on Add Parameter, and we can select any option as shown in the above image.
Step 3: Select the Choice Parameter
Choice Parameter
As I want to run my tests on different browsers, I have selected Choice Parameter.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-132.png?w=1200)
- Give the Name of the Parameter.
- Give the Choices of the Parameter – Chrome, Firefox, IE
- Give the Description of the Parameter – Select any browser to run the tests (optional).
Step 4: Select a custom workspace
Mention the full path of the project in the Use custom workspace.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-118.png?w=780)
Step 5: Source Code Management
In the Source Code Management section, select None.
Step 6: Build Management
Go to the Build section of the new job. Select “Execute Windows batch command”.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-119.png?w=407)
Mention the command needed to execute the tests. In this case, I have to execute all the tests, so used the below command:
robot --variable browser_name:"%browserName%" --include "%Tags%" .
Step 7: Select “HTML Reports” from “Post Build Actions“
Scroll down to “Post Build Actions” and click on the “Add Post Build Actions” drop-down list.
Select “Publish HTML Reports“.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-128.png?w=929)
Enter the HTML directory to archive – Empty, Index page[s] – report.html, and Report title – HTML Report.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-129.png?w=921)
Click on the Apply and Save buttons.
If you want to see where the report is saved in Jenkins, go to the Dashboard -> RobotFramework_Demo -> Workspace -> report.html.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-130.png?w=921)
We have created a new project “RobotFramework_Demo“.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-122.png?w=737)
Step 8: Execute the tests
Let’s execute it now by clicking on the “Build with Parameters” button.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-121.png?w=317)
This screen contains the parameters which we have to select. The browser was a choice parameter and selecting a parameter from it and Tags was also a Choice parameter, so mention the tags in it and click on the “Build” button.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-123.png?w=819)
Right-click on Build Number (here in my case it is #11).
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-124.png?w=327)
Click on Console Output to see the result.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-125.png?w=1097)
Step 9: View the HTML Report
Once the execution is completed, click on go “Back to Project“, and we could see a link to view the “HTML Report“.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-126.png?w=299)
Click on the HTML Report. It displays the summary of the tests.
![](https://qaautomation.expert/wp-content/uploads/2023/04/image-127.png?w=888)
Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!
Additional Tutorials