Jenkins Integration – Parameterized Job

Run Jsystem Code with Parameters

In the previous tutorial we have configured a maven build step that runs Jsystem’s test code with the following command:

org.jsystemtest:jsystem-maven-plugin:run -Dscenario=scenarios/default -Dsut=default.xml

in this case the scenario and the SUT are “hard coded” into the job’s configuration, which can be fine, but we want to give the user an option to set the scenario and the SUT.

Adding parameters to a job:
  1. Enter the job’s configuration
  2. Check “This build is parameterized” (should be one of the first options)
  3. Click “Add Parameter”
  4. Choose “String Parameter”
  5. Name the Parameter “SUT” – you can give it a default value and a short description
  6. Return on steps 3-5 only this time for SCENARIO
Maven Build Step Configuration

Go to the maven build step and change the following:
for windows machine:

org.jsystemtest:jsystem-maven-plugin:run -Dscenario=scenarios/%SCENARIO% -Dsut=%SUT%

for Linux machine

org.jsystemtest:jsystem-maven-plugin:run -Dscenario=scenarios/$SCENARIO -Dsut=$SUT

Click Save.

Nir Armon
View Nir Armon's LinkedIn profileView Nir Armon’s profile

Fork me on GitHub