Run parametrized tests in parallel

If you use Perfecto native automation scripts, you will probably face the need to parametrize and structure them in Test Suits. Going further, you can even execute your tests in parallel. This way, you can have properly structured regression and smoke tests. You will also save time running the executions. You can also go forward and use the scheduler to automate this process.

Step-by-step instructions to create parameterized tests

Watch this video or follow the following steps.

  1. Create the test you want to parametrize, adding all steps and commands you need to make one fully functional scenario.
  2. Create a new test script, where you have an Open device. Then, add your already created full test as many times as your parametrization needs. Last, close your device:

  3. For each of the added copies of your script, add the values that you want to use in your parametrization. By doing this, each of the executions of your script will use different data values.

  4. The steps above will execute your test against the same device one after another. To ensure this mode of executions, confirm that your execution mode is either cleared or configured with the "sync" or "embedded" option, as shown in the following image.

  5. To ensure that your execution won't stop if any of the scenarios fails, on the On Error tab, from the drop-down menu, select CATCH. This way, if any of the parametrized versions of your main script fails, the next version still starts. You can do the same for the Open Device command. By doing this, you will ensure that if your device is busy. You can implement a device handling mechanism.

  6. If you need to run your tests on several devices, not just on one but you still prefer to keep the test running one after another, you will need to create few variables containing the devices you will need. 

  7. Then double click the scripts themselves and change the way they allocate device, to use the specific variable you created:

  8. Make sure you clear the Allocate devices automatically checkbox from the More Menu.

Step-by-step instructions to create parallel executions

  1. The first thing you have to change in your Test Suit/Runner (basically the big test that holds your parameterzied options of your scripts) is to remove the open and close device commands. It will contain only your scripts and look like this:

  2. The only other thing you have to change, to make your tests run in parallel is double-click your scripts and change the script execution mode to Async.

  3. To automate the test executions, see Scheduler - scheduling script executions.
  4. To improve your reporting further, see Add job name and job number to CI jobs, where you can follow the steps and add a dynamic job number and name.