Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies.

For more details:

Job Setup in Jenkins

1. Jenkins Set Environment Variables

When a Jenkins job executes, it sets some environment variables that you may use in your test script as environment variable, in shell script, batch command, Ant script or Maven POM. For our propose, we need following Jenkins environment variables:

Environment Variable NameDescription
JOB_NAMEName of the project of this build. This is the name you gave your job when you first set it up.
BUILD_NUMBERThe current build number, such as "153"

Above environment variables can be used as command line parameters or can be accessed as environment variable with in script.

For more details:

Apart from above two parameters, we might need third parameter "tags". We have to create custom parameters in Jenkins to pass tags.

2. Jenkins Parameterised Job

Jenkins provides capability to define custom environment variables. These variables are available to scripts and command line tools as environment variable.

Create a parameterised build and define the following parameter:

You can pass one or more tags. You have to implement logic in your script to convert delimited string into array.

Note: You can create any variable, we have to use the same name in scripts. The variable names are case sensitive.

For more details:

Once the Job is setup, we can trigger our test with above parameters and we can handle the parameter based on the technology/build tool used.
TechnologyRelated Article
Node.jsNodejs and Reporting with Jenkins