Inserting Output Values
It is a step in which one or
more values are captured during test execution.
The values can later be used as
input at a different point in the run session or we can use as input for
another test.
It is stored in run time data
table; it is located in QTP result window and can be retrieved later.
Types of Output Values:
1. Standard
output value
2. Text
output value
3. Text
area output value
4. Database
output value
5. XML
output value (From Application)
6. XML
output value (From Resource)
1) Standard
output value:
We can use standard output values to output
the properties values of most objects.
Navigation:
Keep tool under Recording mode
> Insert menu >output value> standard output value > show the
object > click ok > select property > modify the column name (if
required) > click ok >click ok >stop recording.
2) Text
output value:
We can use Text output values
to output text strings displayed in an application. When creating a text output
value we can output a part of the objects text and we can also specify text
before and after options.
Navigation:
Keep tool under recording
mode> Insert menu> output value > text output value > show the text
>select one of the option(output text/text before/text after) > click
modify if you want to change the column name > click ok > click ok.> check
in runtime table after running it.
3) Text
Area output value:
We can use text area output
values to output text strings displayed within a defined area of the screen.
Navigation:
Keep tool under recording mode >
insert menu >output value > text area output value >Mark the text area
>click modify the column name if necessary > click ok > again click ok
> check in run time table after running it..
4) Database
output value:
We can use Database output
values to output the value of the contents of database cells.
Navigation:
Insert menu> output value >
Database output value> choose specify SQL statements manually >click next
>click create >Select Machine Data source > Select Driver
(QT_flight32) > click ok > enter SQL statement (select *from orders) >
click finish > select data cells > click ok > Run and it will capture
and see the results in run time table.
5) XML
output value (from application):
we can use XML output values to
output the values of XML elements in XML documents.
Navigation:
Keep tool under recording mode with web environment > Insert menu > output
value > XML output value from application > Show the XML document > select
elements > click ok >stop recording.
6) XML output Value (From Resource):
We can use XML output values to
output the values of XML elements in
XML documents.
Navigation:
Insert
menu >output value> XML output value from resource > browse path of
the XML file > click ok > select elements >click ok.
Inserting Transaction Points
QTP is
providing a Utility object called Services for measuring
transaction timeSuppose, we want to measure how much time that one test or part of the test is taking for execution/running, we can measure using these transaction point (Start and End)
Syntax:
Services.StartTransaction “Transaction Name”
Statements
-------
------
Services.EndTransaction “Transaction Name”
Note: these options (Start and End Transactions) available in QTP tool Insert menu
Example:
services.StartTransaction "Login"
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "naga"
Dialog("Login").WinEdit("Password:").SetSecure "4baf50f18b0ae0d5f5425fe760653e96da50bde7"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Activate
services.EndTransaction "Login"
Note: We can insert number of transaction points in a test
Using Timer Function
‘Timer’ is a VB Script Built-in function, that can be used for measuring transaction time.
ST=Timer’ It returns elapsed time since 12:00 AM Mid night in seconds
Example:
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "naga"
Dialog("Login").WinEdit("Password:").SetSecure "4baf50f18b0ae0d5f5425fe760653e96da50bde7"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Activate
ET=Timer
TT=ET-ST
msgbox TT
Note: here ST, ET and TT are variables, you can take any variable, I used:
ST for Start Transaction
ET for End transaction
TT for Transaction Time
No comments:
Post a Comment