Context
When you need to apply the same action to many items, loops keep the suite concise. A list variable together with a FOR loop replaces repeated keyword calls with a single readable block.
Theory
A FOR-IN loop repeats a block of keywords for every value in a sequence. It starts with FOR, declares a loop variable, uses IN to separate it from the values, and ends with END. List variables are defined with @{NAME} and unpack into individual values when used after IN.
Task
- Create a list variable @{FRUITS} with values: apple, banana, cherry.
- Create a test case named Loop Test that loops over @{FRUITS} and logs each fruit.
Checks
Run your code to see terminal output.
Context
When you need to apply the same action to many items, loops keep the suite concise. A list variable together with a FOR loop replaces repeated keyword calls with a single readable block.
Theory
A FOR-IN loop repeats a block of keywords for every value in a sequence. It starts with FOR, declares a loop variable, uses IN to separate it from the values, and ends with END. List variables are defined with @{NAME} and unpack into individual values when used after IN.
Task
- Create a list variable @{FRUITS} with values: apple, banana, cherry.
- Create a test case named Loop Test that loops over @{FRUITS} and logs each fruit.