Parameterize job in Jenkins



Hi All,

In today's blog, we are going to see How to Parameterize our jobs in Jenkins for performing multiple kinds of actions from a single job. So simply starting with the need for this. There may arise a case where you are passing the Credentials and environment from outside the code by means of a CSV file saved in Amazon S3 or you have different TestNG configuration files with different data set and wish to choose one among those. In all these cases the Jenkins job needs to know and forward the same information to the executable. So this can be achieved by using the inbuilt feature of the Parameterization of Jenkins


So let's start with this.

For this, you first simply need to create a New Item from the Jenkins Dashboard, which is actually a new project for you.


As soon as you name the Item and click on Save, you will land on the Configuration page of the new Item. Click on the This project is parameterized checkbox. You may now see a dropdown with different options to make multi-select options.




Let's select the Choice Parameter option. New fields may appear, give Name as some unique name to the available choices, and below in Choices give the options to select from. Here, we have given options such as CSV, TXT, PNG, and JPG.



Click Save.
On the Job Details page, you can now see an option as Build with Parameters, upon click on this you will get a dropdown.


Click on the required option to run the Jenkins job with and Woosh! It is done... 

Next, I would be coming up with one such practical example where we will parameterize the Selenium Test Execution job and select the TestNG.xml file having distinct Testcases in it.

Thank you

Comments

Popular posts from this blog

Passing Data From the TestNG.xml file to Tests

Demo Click Jack Maropost.Com