UFT 11.51 API test – How to loop a test step and advance data table row
Question ID: 104908
0
0

My API test connects to a database, runs a SELECT statement, closes the db connection. I want the SELECT step to iterate 3 times, issuing the same query but for a different value in the WHERE clause. The variable data is a "Developer Name".

– I’ve put a loop around my select step.
– I’ve set up a data table called "Developers" with three rows, each with a different "Developer Name" in it.
– In the select step’s input properties, I’ve set the "query string" property value to:

SELECT td.CHANGESET.CHS_DATE, td.CHANGESET.CHS_MESSAGE FROM td.CHANGESET WHERE td.CHANGESET.CHS_COMMITTER = ‘{DataSource.Developers.Developer Name}’

– I’ve verified that the loop properties are set to "Start at first row, forward 1 row, end at last row, wrap around".

Yet, when I run the test, it does three iterations, but uses the same "Developer Name". The rows are not advancing. What am I missing?

Thanks in advance.
Candy

Marked as spam
Posted by (Questions: 25, Answers: 12)
Asked on March 20, 2013 12:37 pm
362 views
Answers (3)
0
Private answer

Is there an option to do a 'For Each Item' for the loop? I know in ST 11.2, you use this option and then tie it to the data source you are using.,

Marked as spam
Posted by (Questions: 0, Answers: 3)
Answered on March 20, 2013 1:53 pm
0
Yes, and that is already set. Which is what is baffling me. There are 3 items in the data table, and the for each is working (the step iterates 3 times). It's just that the data from the datatable row is not being substituted correctly. Every iteraton is using the value from row number 1.
( at March 20, 2013 2:25 pm)
0
Private answer

Got the answer all on my own! What I had failed to do was this:
In the Input Properties for the Loop surrounding my Select step, I needed to set the value of ''Loop for each item in:'' to point to my Developers data table. Once I did that I was good to go. I'm not really sure why the step was iterating before without this being set, but it was.

Marked as spam
Posted by (Questions: 25, Answers: 12)
Answered on March 20, 2013 2:26 pm
0
Private answer

Hello @CandyB , Thank you for shearing your experience. I have almost the same issue that you had and I think maybe you can help me. I need to run a loop of 3 items where the property named ''accountType'' changes in the following way:
Iteration1: ''accountType=VOICE''
Iteration2: ''accountType=SMS''
Iteration3: ''accountType=GPRS''

See the image below.
![alt text][1]

How can I do that? It would be grat if you can help me on this. Thankyou in advance.

[1]: /storage/temp/918-2019-01-29-15-51-18.jpg

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on January 29, 2019 7:43 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top