1.Using QTP feature StartTransaction and EndTransaction given in the Insert toolbar options
Services.StartTransaction "str"
msgbox "I"
msgbox "am"
msgbox "Learning"
msgbox "QTP"
Services.EndTransaction "str"
2.Using MercuryTimers Function and we can give any thing in place of time in the following code it will give total time taken in seconds .
MercuryTimers("Time").Start
msgbox "I"
msgbox "am"
msgbox "Learning"
msgbox "QTP"
TimeTaken=MercuryTimers("Time").Elapsedtime
msgbox TimeTaken
msgbox "I"
msgbox "am"
msgbox "Learning"
msgbox "QTP"
TimeTaken=MercuryTimers("Time").Elapsedtime
msgbox TimeTaken
3.Using Vbs will not heve any dependency on QTP what we need to do over here is we just need to the Hour,minute and second from the time and manipulate it to get the total trasaction time .
StartHour = Hour(now)
StartMin = Minute(now)
StartSec = Second(now)
msgbox "I"
msgbox "am"
msgbox "Learning"
msgbox "QTP"
EndHour = Hour(now)
EndMin = Minute(now)
EndSec = Second(now)
StartingSeconds = (StartSec + (StartMin * 60) + (StartHour * 60))
EndingSeconds = (EndSec + (EndMin * 60) + (EndHour * 60))
CallTimeSeconds = EndingSeconds - StartingSeconds
MsgBox CallTimeSeconds
StartMin = Minute(now)
StartSec = Second(now)
msgbox "I"
msgbox "am"
msgbox "Learning"
msgbox "QTP"
EndHour = Hour(now)
EndMin = Minute(now)
EndSec = Second(now)
StartingSeconds = (StartSec + (StartMin * 60) + (StartHour * 60))
EndingSeconds = (EndSec + (EndMin * 60) + (EndHour * 60))
CallTimeSeconds = EndingSeconds - StartingSeconds
MsgBox CallTimeSeconds
No comments:
Post a Comment