Generating Jenkins project configuration for running tests or suites

You can generate a Jenkins project configuration file from HCL OneTest™ API by using the Integration Tester Test Execution plug-in. You can use the generated configuration file for running tests and suites in a Jenkins project.

Before you begin

You must have created a project and that project is open in HCL OneTest API.

Procedure

  1. Select Generate External Tool Configuration from the Tools menu.

    The Generate External Tool Configuration wizard is displayed.

  2. Complete the following steps in the Configuration type and environment window of the Generate External Tool Configuration wizard:
    1. Select Jenkins project configuration for executing tests or suites using the Integration Tester Test Execution plug-in.
    2. Select the HCL OneTest API environment from the list in which the selected resources are to be run.
    3. Click Next.

    The Select resources window is displayed with the project resources tree.

  3. Complete the following steps in the Select resources window of the Generate External Tool Configuration wizard:
    1. Select the stubs, 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.
    2. Select the way in which the resources are referred by clicking either Name or ID.

      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 selected one or more resources in the Test Factory perspective, those resources are automatically selected to be included in the project configuration.
    3. Click Next.

      The Jenkins project configuration options window is displayed.

  4. Complete the following steps in the Jenkins project configuration options window of the Generate External Tool Configuration wizard:
    1. Select an option from the following options that the Jenkins project configuration script can refer to during a test run:
      • The current installation directory of HCL OneTest API or HCL OneTest API Agent.
      • Allow the script to use the environment variables that can be queried at runtime.
    2. Click Next.

      The Summary window is displayed with a preview of the contents of the Jenkins project configuration file in the XML format.

  5. Complete the following steps in the Summary window of the Generate External Tool Configuration wizard:
    1. Click Browse to select a location.
    2. Enter config for the filename.
      Note: The project configuration file is saved as an XML file by default.
    3. Click Save.
    4. Click Finish.
      An example of the Jenkins project configuration generated by HCL OneTest API 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.hcl.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\HCL\HCLProducts\API</installationDirectory>
            <junitDir></junitDir>
            <loginAsAdmin>false</loginAsAdmin>
            <noDB>false</noDB>
            <noHTTP>false</noHTTP>
            <noResultsPublishers>false</noResultsPublishers>
            <output></output>
            <overrideSlowFail></overrideSlowFail>
            <project>D:\Shivi\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.hcl.products.test.it.jenkins.RunTests>
        </builders>
        <publishers/>
        <buildWrappers/>
      </project>
  6. Create a directory (preferably with the name of the job you want to create) under Jenkins_installation_directory/jobs.
  7. Copy the config.xml file into the new directory.
  8. Complete any of the following options:
    • Restart Jenkins.
    • In the Jenkins admin panel, click Manage Jenkins > Reload Configuration from Disk, and then click OK.

Results

Jenkins lists the new job after it restarts or reloads the configuration from the disk.

What to do next

Configure the Jenkins job as appropriate to run the tests or suites.

Feedback