Looping (For, While)
Automate Test Flows with While Loops in ContextQA
Ready to make your testing smarter and more efficient? Let’s walk through using a While Loop in ContextQA to automatically search through lists, so you don’t have to repeat tasks by hand.
Introduction
In this tutorial, you’ll learn how to set up a While Loop inside a test flow. The goal: automatically scan a long list of nationalities until you find the specific item you’re looking for—all within ContextQA.
Start on the dashboard in ContextQA.
Open your test case list by clicking the pencil icon on the left navigation menu.
Find the test case you’ve created for practicing the While Loop. Open it.
Under the Nationality section of your test case, click Add Step to begin setting up the loop.
Hover over the left-side icons and select While Loop from the menu.
Once the loop is added, select NLP While. You’ll see the element label isn’t visible on the page yet. Click the three dots menu.
Change the selection to locator instead. Enter the name you’re searching for—like `Zimbabwean`—then click Create.
Click Create in the dialog to confirm your While Loop setup.
Now you’ve created your While Loop!
Next, add steps inside your While Loop. Click Reorder and drag the steps you want into the loop.
Click Update when you’re done.
You’ll see these steps listed under your While Loop in the test case.
Run the test case. Watch as it moves through the pages—on the first three pages, it doesn’t find the target nationality. On the fourth page, it locates the correct entry and confirms success.
Congratulations! You just used the While Loop to automatically sift through multiple pages in Orange HRM.
Conclusion
You’ve learned to use the While Loop in ContextQA to automate repetitive searching tasks.
In the next lesson, we’ll build on these concepts to help you create even more powerful, efficient test flows.
Great work advancing your automation testing skills!
Last updated