For Loops, Using the Repeat action in Alchemy Tests

Created by David Rumley, Modified on Mon, 12 Aug at 4:22 PM by David Rumley

In an Alchemy Test, a ‘For Loop’ is sometimes referred to as a repeater.  ‘Repeat’ is an Alchemy built-in Action that produces a ‘for loop’ construct in a test.  The repeat action can iterate over a fixed count, a collection of non-unique elements defined by a special locator, rows in a data source table, or a static list.


Creating a ‘For Loop’


TABLE OF CONTENTS


Step 1: Select the Step(s) to repeat

  • select the step(s) to be included in the for loop by clicking the checkbox to the left of each step


Step 2: Use the Ribbon menu to 'Repeat these Steps'

  • From the ribbon menu choose “Repeat these steps”

Step 3: Name the Function

  • Next, you’ll be presented with a dialog asking you to name the function that you’ll be repeating.  What Alchemy is going to do is, take the steps that you selected in #1 and create a function containing those steps.  It will also, simultaneously, create a For Loop in the main test that calls that function a given number of times.  

Step 4: Select the Loop Mode

  • Loop Mode is where you tell the test what list of items to use for each loop iteration.  Loop mode can be just a fixed count, or it can be a number of rows in a data table, or a number of non-unique elements identified by a special locator.
  • In this example I chose to loop over data.  Specifically a data table I created called "ssst".
  • Inside the function, I use the data in column "c1" of that table.


The test:

The function:


A ‘Repeat’ action can loop over various things including data rows in a data source table, a collection of non-unique elements identified by a special locator, or a fixed count.  Be sure to see this video (linked below) on looping over data in a csv file data source.  

https://youtu.be/fuOPwYbXKJw?si=ALLYt-WR7uJULMXG





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

© Orasi Software, Inc. | All Rights Reserved.