Affichage des articles dont le libellé est Expert View. Afficher tous les articles
Affichage des articles dont le libellé est Expert View. Afficher tous les articles

mercredi 10 juin 2009

QTP expert view: how to exit the test?

We all face the question if we can exit the script when we want: for example, on the beginning of the script we check that the environment is the correct one, and if not, instead of trying to pass all the script and loose time, we should exit the script.
In the expert view, in vbscript, the method that could be used is: ExitTest

mardi 9 juin 2009

QTP tips: check the time to do an action

We all want to know how much time it takes for a page or an action to be done, because we need this to know if our website is fast or not.
In QTP you can check it on a very easy way by using the function "MercuryTimers".

For example:

Browser("browsername").Page("Pagename").Link("Link").Click
MercuryTimers("Timer1").Start 'Start measuring time using Timer1.
Browser("browsername").Page("Pagename").WebTable("Table").WaitProperty "visible", "true", 10000
MercuryTimers("Timer1").Stop 'Stop Timer1.
Reporter.ReportEvent micInfo, "Elapsed Time to display the booking restriction page", "Timer: " & MercuryTimers("Timer1").Stop() & "ms"
If MercuryTimers("Timer1").Stop() > 3000 Then
Reporter.ReportEvent micFail, "", "" 'Failed report if more than 3 seconds
End If

This is very simple, as you see and can be added everywhere in your scripts.
Please don't hesitate if you need details !