Add job name and job number to CI jobs

Once we have our Scripts in place in Perfecto native automation, we can create a New Suite there and add those scripts to the suite that we want to run as part of the suite run. This can be done by just opening up the newly created suite and dragging the test scripts from the left into the suite (as shown in the following image). 

Step-by-step instructions

  1. When Suite is open, click Variables at the top left menu (next to File). In the pop-up window, click the '+' button below 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 DigitalZoom. Value can also be defined later as a parameter that can be generated via other means. You can clean the RunTime checkbox to not specify JobName each time the suite is run. 
  2. Specify a Job Number (which would be an incremental number for each new run of the suite and should be a number higher than the previous run). Click the '+' sign again in the Variables pop-up window and provide the name as 'JobNumber', with Number as type and the value can be left as Zero (as in the following image). You can clear the RunTime checkbox to not specify the JobNumber each time the suite is run. Click OK at the bottom right. At the top left, from the menu, select File > Save.

  3. Use the variables in Scripts that are within this Suite. While this Suite is open, double-click a script that is in this suite and change the value of the 'Usage' column from Constant to Variable for SuiteName and JobNumber from the Drop down.
  4. Similar to Step 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 shwon in the following image). Click OK at the bottom right. At the top left, from the menu, select File > Save.

Now that we have defined SuiteName and Job number both at the Suite and the Script level, let’s try to auto-generate the JobNumber for each job run. We can use a Tcl Script for this. Just take the Default Tcl Script and drag it to your Suite. Double-click it and open its parameters. For the parameter 'Tcl script' with Type 'String' and Usage 'Constant', you can 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. Press OK at the bottom right. At the top left, from the menu, select File > Save.

Following the steps above, 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, as part of an automated run daily or at certain days of the week, and so on.