Hi Friends I am going to share one another qtp vb script function with you and one advance tips of of QTP that you will find very helpful.
Following function (CallTimeSeconds) will give you time duration of your qtp script execution in seconds.You can modify this function if you want time duration in minutes.
------------------------------------------------
Function CallTimeSeconds(StartTime,EndTime)
StartHour = Hour(StartTime)
StartMin = Minute(StartTime)
StartSec = Second(StartTime)
EndHour = Hour(EndTime)
EndMin = Minute(EndTime)
EndSec = Second(EndTime)
StartingSeconds = (StartSec + (StartMin * 60) + (StartHour * 60))
EndingSeconds = (EndSec + (EndMin * 60) + (EndHour * 60))
CallTimeSeconds = EndingSeconds - StartingSeconds
End Function
-------------------------------------------------
Now write following line at the start of your qtp script.
StartTime = Now 'This command will give you present system time.
then write Following lines at end of your qtp script.
EndTime = Now
TimeDiff = CallTimeSeconds(StartTime,EndTime)
msgbox TimeDiff 'You will get time duration in this message box.
---------------------------------------------------
You can modify this script according to your needs and requirements.You are always welcome to if you find any issue with qtp.
No comments:
Post a Comment