How to work with Loops in Test Studio

You may come across many scenario in which you need to execute a particular test several number of times or in other words you need to execute certain number of test steps in a loop.

Let us consider following test. These are automated test steps for login functionality. Assume, you need to run step 2 to step 7 5 times with same data. In this scenario you need to execute from step 2 to step 7 in loop.


To automate above scenario Test Studio provides you out of box solution. You can automate above scenario with Logical Steps. In Test view you will find Logical Steps in Add section.


To put test steps in loop select loop Logical step from Add section and add a Logical Test Step in test. After adding logical step you can change Count. We are setting count as 5 here.


After setting Count drag and drop test steps you want to execute under test. Here we need to drag and drop step 2 to 7 in the loop. After dragging and dropping test steps test will look like below image. Now test step 2 to 7 will be executed 5 times.


In this you can execute a test in loop. Loop Logical steps should be used when you need to execute same test with same data many number of times. I hope you find this post useful. Thanks for reading.

How to work with If-Else logical steps in Test Studio

In this post we will take a look on working with logical steps in Test Studio.


We will understand working with Logical Steps in Test Studio using a Test Scenario. Let us suppose you have a Web Application as following. User will enter numbers in text input and click on the Add Numbers button to get the summation of two numbers. Summation of numbers are displayed in a span.


Now suppose we have a test scenario stated as below,

“If output contains 89 then navigate to Google (or perform any other tasks) else navigate to Bing (or perform other tasks)

We are going to walkthrough, how this could be achieved.

Start recording the test.

Step 1

Navigate to application. In this example test application is on local host and can be accessed at URL http://localhost:55391/demoifelseteststudio.html

Step 2

Enter numbers in both input text boxes

Step 3

Click on the Add Numbers button

Step 4

From docked Test Studio panel, select option of Enable or Disable hover over highlighting


And select output span to put a verification step,


Select the option of Build Verifications. Here create a verification step by clicking on Content then choosing contains from drop down.


Now minimize the browser and go back to Test Studio to verify that all test steps got created as expected or not. Make sure that you are minimizing Test Studio not closing it.

Step 5

In Test Studio you will find all the recorded steps so far,


Now from the ribbon click on Logic and select If-Else


After selecting if-else, you will find two steps has been added. Hover over step contains if statement. You will get a green add button.


Click on the green add button to add a verification step as condition of if statement. Next you will find that a green add button next to the verification step (in this case InnerText Contains 89 of outputspan). Click on the green add button to select that verification. After that you will notice that that verification step has been added as condition of if statement.


Step 6

Maximize the browser in which we were recording the testing steps. And browse to . Again minimize the browser and come back to Test Studio.

Step 7

You will find a step has been added.


Drag this step and drop on if condition step.

Step 8

Maximize the browser in which we were recording the testing steps. And browse to . This time close the browser to stop the recording.

Step 9

You will find a step has been added.


Drag this step and drop on else condition step.

Now you have successfully added if-else logical step in the Test. Go ahead and execute the test and you will find all the test steps has been passed with if statement


If you change verification step form contains to not contains then steps of else condition will get executed.


In this way you can work with if-else logical condition in Test Studio. I hope you find this post useful. Thanks for reading.