Generating a Jenkins project configuration file for running tests or suites
After you create tests or test suites for your application in IBM® DevOps Test Integrations and APIs (Test Integrations and APIs), you can generate a project configuration file for the tests.
- You must have created a project and the tests for your application in Test Integrations and APIs. See Creating and running a test.
-
You must have the project open in Test Integrations and APIs.
-
Select Generate External Tool Configuration from the
Tools menu.
The Generate External Tool Configuration wizard is displayed.
-
Complete the following steps in the Configuration type
and environment window of the Generate External
Tool Configuration wizard:
- Select Jenkins project configuration for executing tests or suites using the Integration Tester Test Execution plugin.
- Select the Test Integrations and APIs environment from the list in which the selected resources are to be run.
- Click Next.
The Select resources window is displayed with the project resources tree.
-
Complete the following steps in the Select
resources window of the Generate External Tool
Configuration wizard:
-
Select the tests or suites that you want to include in the
project
configuration.
Note: You can select multiple items by pressing the Ctrl or Shift key and clicking the tests or suites.
-
Select from the options Name or
ID, in which the resources are
referred.
The advantage of using names is that they are more easily recognizable. If you delete the resource from the project and create another resource with the same name, the script still works.
If you choose to use IDs, you can rename or move the resource within the project, and the script still works.
Note: If you have selected one or more resources in the Test Factory perspective, those resources are automatically included in the project configuration. -
Click Next.
The Jenkins project configuration options window is displayed.
-
Select the tests or suites that you want to include in the
project
configuration.
-
Complete the following steps in the Jenkins project
configuration options window of the Generate
External Tool Configuration wizard:
-
Select an option from the following that the Jenkins project
configuration script can refer to during a test run:
- The current installation directory of Test Integrations and APIs or IBM DevOps Test Integrations and APIs Agent (Test Integrations and APIs Agent).
- Allow the script to use the environment variables that can be queried at runtime.
-
Click Next.
The Summary window is displayed with a preview of the contents of the Jenkins project configuration file in an XML format.
-
Select an option from the following that the Jenkins project
configuration script can refer to during a test run:
-
Complete the following steps in the Summary
window of the Generate External Tool
Configuration wizard:
- Click Browse to select a location.
-
Enter config for the filename.
Note: The project configuration file is saved as an XML file by default.
- Click Save.
-
Click Finish.
An example of the Jenkins project configuration generated by Test Integrations and APIs is as follows:
<?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers/> <concurrentBuild>false</concurrentBuild> <builders> <com.ibm.products.test.it.jenkins.RunTests plugin="jenkins-it-runtests@1.920.0"> <additionalArgs></additionalArgs> <baseTempDirectory></baseTempDirectory> <environment>RedHatTest</environment> <environmentTags></environmentTags> <input></input> <installationDirectory>C:\Program Files\IBM\DevOpsTestAPI</installationDirectory> <junitDir></junitDir> <loginAsAdmin>false</loginAsAdmin> <noDB>false</noDB> <noHTTP>false</noHTTP> <noResultsPublishers>false</noResultsPublishers> <output></output> <overrideSlowFail></overrideSlowFail> <project>D:\User1\Projects\RIT\92\Testfor66501\911RITTest\911RITTest.ghp</project> <projectPassword></projectPassword> <projectUser></projectUser> <resultsServerLogging></resultsServerLogging> <securityToken></securityToken> <startupTimeout></startupTimeout> <tests>addNumbers/addition/additionTest</tests> <useResultsPublishers></useResultsPublishers> <vmArgs></vmArgs> </com.ibm.products.test.it.jenkins.RunTests> </builders> <publishers/> <buildWrappers/> </project>
-
Create a directory preferably with the name of the job you want to
create in the following folder:
Jenkins_installation_directory/jobs
- Copy the config.xml file into the new directory.
- In the Jenkins admin panel, click Manage Jenkins > Reload Configuration from Disk, and then click OK to list the new job in Jenkins.
The Jenkins project configuration file for the tests is generated.
You can configure the Jenkins job as appropriate to run the tests or suites. See Configuring the Freestyle project by using the Ant script.