Micro Focus QTP (UFT) Forums
Step time interval - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Step time interval (/Thread-Step-time-interval)



Step time interval - BullzEyezz - 02-21-2011

Is there a way to define time interval for each step, meaning that the step should not take more than a certain amount of time and if does either skip the step or fail the test.


RE: Step time interval - PrabhatN - 02-21-2011

Hi,

Check for "Object synchronization timeout" under File-->Settings-->Run

You can specify a value in second and QTP will wait for that amount of time for every object to be in a specific state. If the time exceeds the specified synchronization timeout, the step will fail.


RE: Step time interval - BullzEyezz - 02-21-2011

But what if the current step is taking too much time and I want to terminate it if it exceeds a certain amount of time?
A simple example, saving a file and the save process takes a lot of time, I want to terminate this step and go to the next step or even fail the whole test.

Not sure if my question is clear enough!


RE: Step time interval - nareshgupta12 - 02-22-2011

for doing this you have two options 1) insert wait statement before the step or you can create dynamic synchronization point in the script


RE: Step time interval - gbkrg9 - 02-22-2011

Try with Wait() function


RE: Step time interval - PrabhatN - 02-22-2011

Ok, i got you. Even i have implemented scenarios like this. But this can be solved by creating your own situational based solutions. As far as i know, QTP directly will not help you on this occasion.

In one my projects, the situation was like there was an object which could be at different statuses at different times (one status at a time). The staus used to change after some event occurs to that object. So after making an event happen on that object, the testing need was to wait till the status changes (say from "AAA" to "BBB") or wait for max 5 minutes and if the status doesn't change within 5 mins, make that step fail and proceed next.

I followed the approach below:

----code for necessary event to change the status
Code:
tCounter = 0 \\ Set a time counter to 0
getStatus = Brower("").Page("").WebTable("").GetCellData(row,col) //status was displayed in a particular cell of a webtable
While (getStatus <> "BBB" And tCounter < 5)
     Wait(60)
     tCounter = tCounter + 1
     getStatus = Brower("").Page("").WebTable("").GetCellData(row,col)
Wend
If getStatus <> "BBB" Then
   Reporter.ReportEvent micFail,"step","desc"
End If

Hope you will get an idea now to design your own approach!


RE: Step time interval - tester_rahul - 02-23-2011

How QTP works is this. it executes the instruction given on the line and then moves on to the next step.
You can use , wait or waitproperty() to make it wait after executing some step.
If you invoke a command line , then again you have a parameter to make QTP wait till the command in the command prompt is executed completely.

There are ways how we can increase the time of execution of each step.
Tools->option -> Run -> Normal display execution( you can customize the delay there) , but this is for all the steps and not for one particular step.
You can choose one out of these.