Last updated: Nov 05, 2019 12:32
Once we have our Scripts in place in Perfecto IDE, we can create a New Suite there and add the Scripts to this suite, ones 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 (screenshot below).
Steps to add Job Name and Job Number:
1. When Suite is open, click Variables on top left menu next to File, in the pop-up window click on '+' button below to add a new Variable called 'SuiteName' or Jobname as Name, and give it a Type (String in most cases) and 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 un-check the RunTime checkbox to not specify JobName for each time when the suite is run.
2. Now after specifying a Job Name, specify a Job Number (which would be incremental number for each new run of the suite and would a number higher than the previous run). Click on '+' sign again in variables pop-up window and give it name as 'JobNumber' with Number as type and Value can be left as Zero (as in screenshot below). You can un-check the RunTime checkbox to not specify JobNumber for each time when the suite is run. Press OK at bottom right. On top left in Menu, do File > Save.
3. After creating variables at Suite level, now let’s use them in Scripts that are within this Suite. While this Suite is open, double-click on a script that is in this suite, and change value of 'Usage' column from Constant to Variable for SuiteName and JobNumber from the Drop down.
4. Similar to Step 3, Value column Drop down select the SuiteName variable for SuiteName Parameter and JobNumber from Drop down for Value for JobNumber Parameter (as in screenshot below). Press OK at bottom right. On top left in Menu, do File > Save.
Now that we have defined both SuiteName and Job number both at Suite and 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 to your Suite. Double click on it and open it Parameters. For Parameter 'Tcl script' with Type 'String' and Usage 'Constant', you can enter this for Value (as in screenshot below): set JobNumber [clock seconds]
The value specified here will generate a JobNumber each time the script is run as a number which is equal to Current Epoch time in milliseconds. Press OK at bottom right. On top left in Menu, do File > Save.
Now following these steps above, you have scripts in a suite that will create a new Job in CI Dashboard when ran the first time, and each subsequent runs will have bar representing each run of the Suite and with a unique job number that is incremental as shown in screen shot below.
PS: You can now add this Suite in Perfecto IDE to Scheduler there as part of Automated run daily or certain days of week, etc.