| || |
QTP Re-executing script after completion of all iteration
Below is my script looks like
For I = 1 to RowCount
After executing ALL test iterationS from Datatable (Global) using For Loop, QTP executes last statement "Browser("Name").CloseAllTabs". Then again it starts executing from top that is Statement 1 and re-entering in For loop to re-executing test data given in Datatable (Global)
Please help and let me know if you need further more information
You've stated the problem but you haven't said what you would like to happen.
Originally Posted by mwsrosso
I am sorry for not providing clarity. I am glad you asked.
Let me provide a little bit more insight.
What I am doing - I am creating a online Resume. For that I am reading one user at a time from datatable and complete the process of creating resume. I have implemented a For loop to cover all test iterations as I stated originally.
Problem - After executing and completing last test iteration from datatable, my script comes out of For Loop and executes the last statement of script "Browser("Name").CloseAllTabs". This is perfectly fine.
What I was expecting - At this point, I was expecting to stop the execution because all iterations have been completed and script also has executed last statement. However, script cursor moved to very first statement of script and start executing from Top to Botton again.
Please let me know if this provides clarity.
Thank you for your help.
I was never a fan of the built in data table. But as I recall when you provide multiple rows like that it is designed to run through the entire script each time for each row as that is its definition of an iteration. If you are looping through and pulling those values in yourself you are going through all the iterations many times over. As designed one row = one test run.
As I recall there is an option in settings somewhere to disable this behavior and only run one iteration.
Last edited by NoUse4aName; 03-23-2016 at 12:48 PM.
Yep, in the Test Flow, right-click your test. Select Settings. In the Test Settings window that is opened, click Run in the menu on the left. On the right, select Run one iteration only. That should change it to behave as you expect.
Thank you friends. You are right. Actually, I was aware of this test setting but I thought running one iteration means running only for one test data and running on all rows means running on all test data given in particular data table. My doubt got clear after visiting following page. It has been really explained quite in detail and I would suggest everyone to visit at least one.
SUDHAKAR'S QUICK TEST PROFESSIONAL BLOG: Test / Action Iterations
Thank you friends.