Generating a Jenkins project configuration file for running tests or suites

After you create tests or test suites for your application in HCL OneTest API, you can generate a project configuration file for the tests.

Before you begin

  • You must have created a project and the tests for your application in HCL OneTest API. See Creating and running a test.
  • You must have the project 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 plugin.
    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 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 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.
    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 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 an 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 in the following folder:

    Jenkins_installation_directory/jobs

  7. Copy the config.xml file into the new directory.
  8. In the Jenkins admin panel, click Manage Jenkins > Reload Configuration from Disk, and then click OK to list the new job in Jenkins.

Results

The Jenkins project configuration file for the tests is generated.

What to do next

You can configure the Jenkins job as appropriate to run the tests or suites. See Configuring the Freestyle project by using the Ant script.