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:

About this task

You can write the test data generated by integrating Jenkins with HCL® OneTest Data into a file or any supported database. After integration with Jenkins, HCL OneTest Data Jenkins Plugin supports the insertion of the generated test data in both JDBC supported database and MongoDB. To write the generated test data in the database, you must establish a connection between HCL® OneTest Data and the 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 the related link.

    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
      Use Custom Trust Store Select the checkbox if the SSL certificate is available in the custom trust store.
      Note: If you do not find details of the custom trust store in the application plugin, then the application navigates to the default trust store to access the certificate.

      The default trust store is at the following location: $JAVA_HOME/jre/lib/security/cacerts

      Optional
      Custom Trust Store Path Enter the path of the custom trust store where the certificate is stored. Required, if Use Custom Trust Store is selected.
      Use Custom Password for the Trust Store Select the checkbox if the default password for the custom trust store is changed when you place the certificate in the custom trust store.
      Note: The default password to access the custom trust store is changeit.
      Optional
      Custom Trust Store Password Enter the password to access the custom trust store. Required, if Use Custom Password for the Trust Store is selected.
      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, JDBC, or MONGODB 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.

      MONGODB: The generated test data is written into MongoDB.

      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. See Viewing the test data generation logs.

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.
  • If you selected MONGODB as the data storage type, then you can use the generated test data from the database.