cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a loop to repeat some steps?

SOLVED
Highlighted
Frequent Contributor

How to create a loop to repeat some steps?

How to create a loop in key word test in tets complete 14 to repeat some steps? 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: How to create a loop to repeat some steps?

From the help topic I posted above.

Operation Parameters

The operation has the following parameters:

Loop Variable

Specifies the name of a variable that will be used as the loop variable. It is used to determine the number of loops (see Remarks below). If you do not specify the loop variable, it will be created automatically when the loop starts and deleted when the loop ends. However, in this case, you will not be able to get access to this variable in your test.

Start Value

Specifies the initial value of the loop variable.

End Value

Specifies the end value of the loop variable. The loop works until the loop variable is equal to the End Value.

Step

Specifies the value to be used to change the loop variable.

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

6 REPLIES 6
Community Hero

Re: How to create a loop to repeat some steps?

For loops for repeating through a list with a designated length.

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/statements/for-loop.html

 

While loop for looping until a condition is no longer true.

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/statements/while-loop.html


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Frequent Contributor

Re: How to create a loop to repeat some steps?

LoopSteps.pngLoopUI.png

The UI screenshot needs a 100 records added . And the steps are in first screenshot. So if I need a loop to add a record in UI 100 times which loop do I use , while or for?

Community Hero

Re: How to create a loop to repeat some steps?

Since you have a fixed limit of 100, I'd use a for loop of 1 to 100 to put those steps in.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Frequent Contributor

Re: How to create a loop to repeat some steps?

LoopDetails.png

 

What needs to be added in 1. Loop Variable and in 4. Step? 

 

Community Hero

Re: How to create a loop to repeat some steps?

From the help topic I posted above.

Operation Parameters

The operation has the following parameters:

Loop Variable

Specifies the name of a variable that will be used as the loop variable. It is used to determine the number of loops (see Remarks below). If you do not specify the loop variable, it will be created automatically when the loop starts and deleted when the loop ends. However, in this case, you will not be able to get access to this variable in your test.

Start Value

Specifies the initial value of the loop variable.

End Value

Specifies the end value of the loop variable. The loop works until the loop variable is equal to the End Value.

Step

Specifies the value to be used to change the loop variable.

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Frequent Contributor

Re: How to create a loop to repeat some steps?

Thanks 

Learnt how to doafor loop with start and end values.