This new feature, introduced in ZebraTester V5.5-X, adds more granular functionality to the existing loop functions that already exist. Included is a quick video that is referenced by the timestamp below.
How to modularize a script
In testing a scenario, a user only wants to log in one time, do multiple actions in the application, and, at the end of these application actions, the user wants to log out.
Normally, in ZebraTester, for every loop, all the pages will execute, so the above scenario isn't possible using the outer loop for a Virtual User.
So what if you used an inner loop? While there's a possibility users can define inner loops around selected pages, which will execute as many inner loops that user set, there's still no way that ZebraTester can control the execution of the last page (for example log out) only at the last loop for a Virtual User.
So we can achieve this scenario in ZebraTester with (1) inner loops and (2) a plugin called "SupportModularScripts" which will be available as a part of the ZebraTester 5.5-X and higher installation.
Example Scenario Context/Requirements
A total of 5 pages in a script.
The first page and last page should only execute one time for a Virtual User.
Execute the first page on the first loop for a Virtual user.
Execute the last page on the last loop for a Virtual user.
The attaching video visualizes how to achieve this, the video has the replay of the script as well as a load test with multiple users.
Video Time Stamp & Step
Video Time Stamp & Step
View of the script. (5 pages)
Page 1: Start Page
Page 2: Booking
Page 3: Media
Page 4 Shopping Cart
Page 5: Home
Clicking into Page 1 (Start Page), the first call, to open the URL Details/Var Handler
Loop Counter Global Variable (LC)
Loop Variable (team)
Input File (team.txt)
Load Test Plug-in #1 (SupportModularScripts)
Time 00:26Manage the Inner Loops from a Page.
Click on Page #1 (Start Page) link in Column 1 that opens up the Manage Page Dialog.
Click on the magnifying glass on the loop to edit the conditions to the target inner loop and set the conditions of when to start the inner loop (from Page #1 (Start Page)).
The Inner Loops started from Page 1 are listed at the bottom of the Manage Page Dialog.
Repeat for Page #5 (Home). Click on the Manage Page Column #1.
Clicking on the magnifying glass for the Load Test Plug-in #1 (SupportModularScripts) will provide more detail on the plug-in and when it executes:
Time 01:17 through 02:01
The Replay the Recording starts and the results show that Pages #1 and 5 each ran once while the pages between them each ran 3 times in one minute.
Delete the Global Variable LC and Define a new user variable “LC” in it's place, with the initial value set to “loop counter”
The Inner Loop magnifying glass for Page 1 shows a similar Manage Page as before when the LC was set as a Global Variable, but now it’s a user variable.
With the variable redefined, regenerate the Load Test.
Re-execute for 2 Concurrent Users to show the User Variable effect on the loops.
The revised LC user variable Test Results show that Pages #1 and 5 each ran twice while the pages between them each ran 18 times over the same 1 minute as our first run.