Generating the test data by using Jenkins

When you perform a test during the continuous integration and continuous deployment process on Jenkins, you might want to generate the test data. You can generate random test data to test your application by integrating Jenkins with HCL® OneTest Data by using the HCL OneTest Data Jenkins Plugin.

Before you begin

You must have completed the following tasks:
  • Installed the latest version of Jenkins.
  • You must have an account in the Jenkins application.
  • Downloaded the latest version of the HCL OneTest Data Jenkins Plugin for the HCL OneTest Data from HCL License & Delivery portal.
  • Installed the HCL OneTest Data Jenkins Plugin in Jenkins.
    Note: You must restart the Jenkins application after installing the HCL OneTest Data Jenkins Plugin.
  • Logged in to HCL OneTest Server.
  • Created a project and a schema in HCL OneTest Data.
  • Established a connection between HCL OneTest Data and a JDBC supported database. See Establishing a JDBC connection with HCL OneTest Data

About this task

You can write the test data generated by integrating Jenkins with HCL® OneTest Data into a file or in a JDBC supported database. To write the generated test data, you must select the data storage type as File or JDBC. If you want to write the generated test data in the database, you must establish a connection between HCL OneTest Data and the JDBC supported database.

Procedure

  1. Log in to the Jenkins application.
  2. Create a Jenkins free-style software project.

    For more details about how to create a project in Jenkins, refer to Building a software project.

    The project dashboard is displayed.

  3. From the project dashboard, perform the following steps:
    1. Click the Add build step list under Build and select Run an HCL OneTest Data Generation.
    2. Set the properties for the HCL OneTest Data Jenkins Plugin for HCL OneTest Data by referring to the following table:
      Field Action Required/Optional
      Name Enter the name of the build. Required
      Server URL Enter the URL of HCL OneTest Server.

      The format for the URL is as follows: https://<fully-qualified-dns-name>/

      Required
      Offline Token Enter the offline token that is generated in HCL OneTest Server. Required
      Project Select the name of the project from the list of your projects. Required
      Schema Select the name of the schema from the list of schemas associated with the project you selected. Required
      Root Element Specify the root path of the element for which you want to generate the test data.

      For example, Root:NewType1

      Required
      Number of Records Enter the number of records you want to generate.

      This field accepts only numbers.

      Required
      Numeric Seed Value Enter the seed value that acts as an instance of random data when you generate the test data.

      This field accepts both positive and negative numbers.

      Optional
      Output Data Storage

      Select the data storage type. The data storage is a location where you want the generated test data to be written.

      You can select File or any JDBC as a data storage type.

      File: The generated test data is written into a file and you can download it in your local file system.

      JDBC: The generated test data is written in the selected JDBC supported database.

      Required
      Connection Names
      Note: This field is enabled only when you select JDBC as the data storage type.

      Select the connection name from the populated list of connection names.

      Required
      Output Format Select the output file format of the generated test data from the populated list of the output formats. The output file format is based on the schema you selected. Required
      Data File Location Specify the location of the output file. If the specified location is invalid, by default, the output file is saved in the HCL OneTest Data server.
      Notes:
      • You can find the output file in the HCL OneTest Data pod at the following location:

        /opt/hcl/hip-rest/output/<accountId>/<userID>/<projectId>/<schemaId>/<genMapPath>

      • This field is not applicable if you select the data storage type as JDBC.
      Optional
    3. Click Save.
  4. From the Jenkins dashboard, select the project and click Build Now.

Results

You have successfully generated the test data by using the HCL OneTest Data Jenkins Plugin.

Note: If the test data generation request fails, you can view the test data generation logs. For more information about the test data generation logs, see the related links.

What to do next

After the build completes, you can perform the following tasks:

  • If you selected File as a data storage type, the generated test data is downloaded in the local file system at the specified location.
  • If you selected JDBC as the data storage type, then you can use the generated test data from the database.