Creating a pipeline script from Jenkins
You must create a pipeline script to run test assets that are available in the Rational® Test Automation Server project from the Jenkins Pipeline project.
Before you begin
You must have completed the following tasks:
-
Installed the Rational® Test Automation Server Jenkins plugin on the Jenkins server. See Installing the Rational Test Automation Server Jenkins Plugin.
-
Generated an offline user token from Rational® Test Automation Server. See Managing access to IBM Rational Test Automation Server.
-
Created a Jenkins Pipeline project.
Procedure
- Open your Jenkins Pipeline project from the list.
- Click Configure, and then select the Pipeline tab.
- Click Pipeline Syntax to generate a pipeline script.
- Select the step: General Build Step option from the drop-down list in the Sample Step field.
- Select the Run IBM Rational Test Automation Server test option from the drop-down list in the Build Step field.
-
Provide the details about the test run for the fields in the following
table:
The following table lists the required fields that you must provide to run the test from Jenkins:
Fields Action Name Enter a name for the Jenkins build step.
Server URL Enter the URL of Rational® Test Automation Server.
The format of the URL is as follows: https://hostname.
Offline Token Enter the offline user token that you generated from Rational® Test Automation Server. Field Description Asset Type Use this field to select the test asset type that you want to run from the Asset Type drop-down list.
Branch Select the branch from the drop-down list.
The Branch drop-down list displays the branches that are available in the corresponding project of Rational® Test Automation Server.
Datasets Use this field to enter the path to the dataset if you want to replace the values of the dataset during a test run.
You must ensure that both original and new datasets are in the same workspace and have the same column names. When you enter a value for the Datasets field, you must also include the path to the dataset. The path must be in the following format:
/project_name/ds_path/original_ds.csv:/project_name/ds_path/new_ds.csv
Note: You can override multiple datasets that are saved in a different project by adding multiple paths to the dataset separated by a semicolon.Labels Use this field to add labels to test results when the test run is complete.
You can add multiple labels to a test result separated by a comma.
For example, label1, label2
After the test run is complete, then the values provided in the Labels field are displayed on the Results page of Rational® Test Automation Server.
Project Use this field to select a project from the drop-down list.
The Project drop-down list displays the projects that are available in the corresponding team space of Rational® Test Automation Server.
Note: The Project drop-down list displays the projects where you are an Owner or a member of Rational® Test Automation Server. You must be an Owner or a Tester of the project that is available in the team spaces to run the tests from the Jenkins server.Secrets Collection Use this field to select the Secret from the Secrets Collection drop-down list if you created secrets collections for your project to use Secrets at test run time.
The Secrets collection field is mandatory only if you select one of the following options in the Asset Type field:- APISUITE
- APITEST
- APISTUB
The following message is displayed when you select any other asset type than preceding list:
You can select Secrets collection only if you are running tests of type APISUITE, APITEST, or APISTUB.
Start Date Use this field to enter the date and time in the following format for running tests at the scheduled date and time:
yyyy/MM/dd/HH:mm
When you enter a value in the Start Date field, the status of the test displays as Scheduled on the Overview and Progress pages of Rational® Test Automation Server.
Team Space Use this field to select the name of the team space from the drop-down list.
The Team Space drop-down list displays the names of the team spaces if you are an Owner or a member of the team space.
Test Use this field to select the required test that you want to run from the drop-down list.
The Tests drop-down list displays the available test assets from the corresponding branch in the following format:
Project_name [Path: the path of the test assets] [Repo: URL of the Git repository that the test belongs to]
Note: After you select the test details from the Tests drop-down list if you want to change the URL of Rational® Test Automation Server, offline user token, or the project in the Jenkins Build step, then you must delete the build step and add a new build step.Test Environment Use this field to select an environment from the drop-down list.
The Test Environment field displays the available test environments from Rational® Test Automation Server.
The Test Environment field is mandatory only if you select one of the following options in the Asset Type field:- APISUITE
- APITEST
- APISTUB
The following message is displayed when you select any other asset type than preceding list:
You can select Test Environment only if you are running tests of type APISUITE, APITEST, or APISTUB.
Use Custom Trust Store Select this checkbox if you used an internal CA certificate and imported the certificate to the custom trust store. You can then enter the file path of your trust store followed by the file name in the Custom Trust Store Path field.
Select the Use Custom Password for the Trust Store checkbox if you modified the trust store password, and then enter the new password in the Custom Trust Store Password field.Note: If you did not modify the trust store password, you must clear the Use Custom Password for the Trust Store checkbox.Variables Use this field to enter the name of the variable and its value if your test requires variables during the test run time.
You must enter the variables in the following format:
name_of_the_variable=value_of_the_varibale
You can add multiple variables to the test run separated by a semicolon.
For example, varname1=value1;varname2=value2
- Click Generate Pipeline Script and copy the script that you created for the build step to use it in the sample script.