Add job name and job number to CI jobs

When you have your scripts in place in Perfecto native automation, you can create a new suite and add those scripts to the suite that you want to run as part of the suite run. To do this, you open the newly created suite and drag the test scripts from the left into the suite, as shown in the following image. 

By performing the following procedure, you have scripts in a suite that will create a new job in the CI Dashboard when run the first time. Each subsequent runs will have a bar representing each run of the Suite and with a unique job number that is incremental, as shown in the following image. 

In Perfecto, you can add this suite to the Scheduler to run it as part of an automated run, either daily or at certain days of the week, as required.

To add job name and job number to CI jobs:

  1. To create variables, do the following:

    1. When the suite is open, at the top left, click Variables (next to File).

    2. In the pop-up window that opens, at the bottom, click the add button + to add a new variable called SuiteName or Jobname as Name, and give it a Type (String in most cases). The Value will be the name of the job that would appear in the CI Jobs tab in Perfecto Smart Reporting. You can also define the value later as a parameter that can be generated via other means.

    3. (Optional) If you do not want to specify JobName each time you run the suite, clear the RunTime checkbox. 

    4. Specify a Job Number (an incremental number for each new run of the suite and a number that is higher than the previous run).

    5. In the Variables pop-up window, click the add button + again and provide the name as JobNumber, with Number as type. You can leave the value as Zero (as shown in the following image).

    6. (Optional) If you do not want to specify the JobNumber each time you run the suite, clear the RunTime checkbox.

    7. Click OK.

    8. At the top left, from the menu, select File > Save.

  2. To use the variables in the scripts that are part of the suite, while the suite is open, do the following:

    1. Double-click a script that is in this suite.

    2. From the drop-down list, for SuiteName and JobNumber, change the value of the Usage column from Constant to Variable.

    3. From the Value column drop-down list, select the SuiteName variable for the SuiteName parameter and JobNumber from the drop-down list for the value for the JobNumber parameter (as shown in the following image).

    4. Click OK.

    5. At the top left, from the menu, select File > Save.

  3. Auto-generate the JobNumber for each job run using a Tcl script, as follows:

    1. Take the default Tcl Script and drag it to your suite.

    2. Double-click the script and open its parameters.

    3. For the parameter Tcl script with Type = String and Usage = Constant, enter the following value (as shown in the following image):

      set JobNumber [clock seconds]

    The value specified here will generate a JobNumber each time the script is run as a number that is equal to Current Epoch time in milliseconds.

  4. Click OK.

  5. At the top left, from the menu, select File > Save.