This is a migrated thread and some comments may be shown as answers.

How to find the number of times (if loop ) is executed in the testlist

3 Answers 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nithya
Top achievements
Rank 1
Veteran
Nithya asked on 17 Dec 2020, 10:39 AM

Hi , 

I have a test list which has a test(with if and Else condition). I have 10 iterations. When I run the list, I have both If and Else conditions running. 

My question is  : After the test list is completed, Is there a way to find , how many times the if loop is executed.. ? How many times the else loop is executed  ? in the same test list.

 

Could you please help me on this.

 

Regards ,

Nithya A.

3 Answers, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 17 Dec 2020, 11:52 AM

Hello Nithya,

Thank you for posting about your test scenario. I prepared a sample Test Studio project with 10 iterations that randomly goes in the If or Else loop and logs the total number of times each of those loops were executed. You can find the sample project attach to this post and check the details below.

  • To achieve this I added two static public variables "ifCount" and "elseCount" to keep track of the number each iteration passed through If and Else conditions.
  • There is one coded step in the If and Else loop to increase the static variables by 1 each time the test execution goes in the loop.
  • The final coded step will log the value of the "ifCount" and "elseCount" variables and you can see the number of times the test passed through If and Else conditions respectively. 

I hope the above example helps you apply something similar to your project. If you need further assistance, please do not hesitate to contact us again and share additional details about your test configuration.

Regards,
Plamen Mitrev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
0
Nithya
Top achievements
Rank 1
Veteran
answered on 12 Jan 2021, 11:52 AM
Sorry for the delayed response. It helped me. Thank you. 
0
Plamen Mitrev
Telerik team
answered on 12 Jan 2021, 12:45 PM

Hello Nithya,

Thank you for you feedback! I am happy to know that my suggestion was helpful.

Regards,
Plamen Mitrev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
Nithya
Top achievements
Rank 1
Veteran
Answers by
Plamen Mitrev
Telerik team
Nithya
Top achievements
Rank 1
Veteran
Share this question
or