Beruflich Dokumente
Kultur Dokumente
FAQ in QTP
1. What are the very important prerequisite to be known before working with QTP ?
Quick Test Professional support many scripting Language, but this blog discusses QTP with
VBScript.
QTP is a very fascinating tool and it tries to recognize as much object in Application as possible.
The Process of identifying object happens as one given below
QTP’s object identification concept is based on 4 types of properties and an ordinal identifier.
Types of properties:
A test engineer can specify list of mandatory properties, assistive properties, base filter
properties, optional filter properties and Ordinal Identifier
First of all QTP will learn all the specified mandatory properties and then think whether
these properties are sufficient to identify the object uniquely. If it feels sufficient it will stop
learning. Otherwise it will learn the 1st assistive property. Then once again think whether all the
properties are sufficient for identifying the object uniquely. If at all it feels sufficient it will stop
learning otherwise it will learn the 2nd assistive property and then think again whether all these
properties are sufficient for identifying the object uniquely. This process continues till the QTP get
satisfied or up to the end of the assistive properties list.
If still QTP feels not satisfied then finally it will learn the ordinal identifier. All the
properties learnt during this process will be stored in the object repository.
If at all the smart identification option is selected then the QTP will learn the base filter properties,
optional filter properties along with the mandatory properties and stores the base filter properties
and optional filter properties separately and secretly and then continues with the same procedure
as above.
The ordinal identifier assigns the object numerical values that indicate its order relative to
other objects with an otherwise identical description
1. Location
2. Index
3. Creation Time
1. Location: If at all the Location is selected as an ordinal identifier then the QTP will generate the
sequence of numbers from 0,1,2,… based on the sequence of the objects located in the
application.
2. Index: If at all the index is selected as an ordinal identifier then the QTP will generate the
sequence of numbers from 0,1,2,… based on the sequence of the programs of the corresponding
objects.
3. Creation time: If at all the creation time is selected as an ordinal identifier then the QTP will
generate the sequence of numbers from 0,1,2,… based on the loading time of a web page.
Object Repository (OR) is used to store all the recorded Applications Objects
(Property and Value) in QTP.
Each time while Identifying an Object QTP checks OR and then identifies the
Object in Application.
Name = “Yes/No”
Here Class Name is called as Property and “Checkbox” is its associated Value.
Scenario:
OS=”Windows XP”
Flag = 3
to be accessed throughout the Test (Including all the Actions within the Test) we need to declare
these variable in all the Action and then access them in Scripts.
What happen if there are multiple Variables whose values are same and does not change and we
require them in all Actions ?.
Using User Defined Environment Variable we can access all Variable and its values throughout
the test without needing to declare them.
File –> Settings –> Environment Tab –>select Variable type as “User Defined” and add the
Variable say “myOS” as Name and Value as “WindowsXP” (Remove quotes)
myValue = Environment(”myOS”)
msgbox(myValue)
Message box will show the Value “Windows XP”
Recovery Scenario is useful while the Test gets interrupted by External Events like Pop-up
window, object state, Test run error, application crash.
Pop-up window: quick test detects a pop-up window and identifies it according to the window
title and textual content.
Object State: Quick test detects a specific test object state and identifies it according to its
property values and the property values of all its ancestors.
Note that an object is identified only by its property values and not by its class.
Test run error: Quick test detects a run error and identifies it by a failed return value from
method.
Application crash: Quick test detects an application crash and identifies it according to a
predefined list of applications.
1. Normal Recording
2. Analog Recording
3. Low Level Recording
Normal Recording
This mode is the default and takes full advantage of the QuickTest test object model, recognizing
the objects in your application regardless of their location on the screen.
Analog Recording
Enables you to record the exact mouse and keyboard operations you perform in relation to either
the screen or the application window. In this recording mode, QuickTest records and tracks every
movement of the mouse as you drag the mouse around a screen or window.
Enables you to record on any object in your application, whether or not QuickTest recognizes the
specific object or the specific operation. This mode records at the object level and records all run-
time objects as Window or WinObject test objects. Use low-level recording for recording in an
environment or on an object not recognized by QuickTest.
Thanks “Source: Mercury QTP Help doc”
There are situation in Real time scenarios where multiple people will be working around with QTP
with same test and hence they will be updating the Object Repository (OR).
During that scenario we can use the Shared Object Repository to store the Object of the
Application and hence concurrent modification in the OR can be done by multiple people at a
time.
We will begin with a simple test like the "Hello World" program with which we start learning any
programming language.
1) First of all click on Record toolbar button ( or Automation menu --> Record or press F3). when we
click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and
choose first option "Record and run test on any open windows based application." and click on ok.
2) Open Flight application (Start -->All programs -->QuickTest Professional --> Sample Applications -->
Flight)
3) Type Agent name as "Shree" (You can enter any, but must be 4 characters or more) and enter
password as "mercury".
4) In the flight reservation window that opens up:
a) In the Flight Schedule area, in Date of Flight enter tomorrow's date in mm/dd/yyyy format.( I used
tabs to move to next fields)
b)In Fly From enter Denver
c)In Fly To enter London
d) Click on Flights button which is on the right hand side of "Fly To".
Let the default option be selected in the Flights Table.
e) Click ok
f)In the name field enter your name. It will fill rest of the required information by itself.
g) Click on insert order and after the order is inserted
h) Click on File --> exit.
5) Now you have recorded your first script. You can click on the expert view tab to see the script which
QTP has recorded for you automatically.
6) Click on run from Automation Menu (or press F5) to open up run dialog box.
7) Go to the "Results Location" tab, and below "write run results to", in "new run results folder" radio
button- let it be the default option --C:\Program Files\Mercury Interactive\QuickTest
Professional\Tests\Test1\Res1(you can also change it)
8) click on ok.
This will run you earlier recorded test and show you the results.
Design time data table is what you see in the main QTP window and run time data table you can see only in the test
results window. Design time data table is always created before running the test while run time data table is generated
after execution of the test.
2) We will click on record toolbar button ( or Automation menu --> record or press F3). when we click
on record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and
choose first option "Record and run test on any open windows based application." and click on ok.
4) Type Agent name as "Niyati" (you can enter any, but must be 4 characters or more) and enter
password as "mercury".
7) In the keyword view you will see four headings- Item, Operation, Value, Documentation. Under
Value click on Kumar and on the right hand side of Kumar you will see a small icon, just click on that
(or press ctrl + F11), The "Value Configuration Options" dialog box opens. In that dialog box click on
parameter radio button and select Data Table from there. In Name field enter any variable name (I
entered 'username'). Let all other be the default options in this dialog box and click on ok.
8) QTP will add username column in the data table (bottom, left hand side) with 'Niyati' as the first
value.
9) Now enter more values in the username column, manually. I entered 'Varun' and 'Tanya' in 2nd and
3rd column respectively.
11) Now run the test. (follow same steps as we did earlier).
12) If the test ran successfully, in the Results summary window on the left hand side you will see three
iterations (because we added 3 variables in the 3 rows of a data table). Expand 1st iteration, it will
show action summary for that iteration, expand the action summary, it will show Login, Expand the
login. Click on the first option under it "Agent Name: SetText". On the right hand side it will show 1st
variable name under details.
What if we want to write a short script that accesses values from the data Table.
1) Make sure that QTP (with a new blank test) and a blank notepad is open.
3) Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to
"Windows Applications" tab and choose first option "Record and run test on any open windows based
application." and click on ok.
Window("Notepad").WinEditor("Edit").SetCaretPos 0,0
Window("Notepad").WinEditor("Edit").Type "a"
rc = DataTable.Value("A", dtGlobalSheet)
msgbox rc
Window("Notepad").WinEditor("Edit").SetCaretPos 0,0
Window("Notepad").WinEditor("Edit").Type rc
9) Run the Test again with a blank Notepad open. It will enter all the three values from Data Table into
the Notepad.
Checkpoint information is stored in the Local Object Repository. It is in the Resource.mtr file which is in
the action folder (if you created checkpoint in action1 then it will be action 1 folder under the folder in
which you are saving the test/script, if you created checkpoint in action 2 then it will be action 2 folder
and so on) .
In the expert view, on any blank line type Checkpoint and put "(". As soon as you put the starting
bracket it will show all the checkpoints you have used in the test.
Now we will start with checkpoints. I will try to show easy to understand example of each and every
checkpoint.
Lets start with simple example of standard checkpoint which checks a variety of objects such as
buttons, radio buttons, combo boxes etc. Standard checkpoints are supported for all add-in
environments
This is a small test in which we have used standard checkpoint and captured the disabled button on
the Flight application. Now we can run the test in two ways to see how it fails and passes the results of
the checkpoint.
Make sure that this test and Flight application is open. Click on run.
It will Run the test and show you the result as pass.
In the Flight application enter the Date of Flight, Fly From and Fly To fields and nothing else. (The
reason for doing this is that it will enable the 'Flight...' button)
It will Run the test and show you the result as Fail. This is because QTP was looking for a disabled
'Flight...' button for which it recorded the information at the record time, but now since the button was
enabled at run time, so it failed.
This will help you in understanding the standard checkpoint in QTP more deeply.
Browser("Google").Page("Google").Check CheckPoint("Google")
I ran this test by opening www.google.co.in in offline mode (not on internet). It recorded the following
properties:
Here it shows the load time as 0 because I did not open Google at the time of running the test, it was
already open.
When you run it, in the results window, on left hand side, it will show (when every option is expanded):
Test Checkpoint-page Summary (where Checkpoint-page is the name with which I saved the test
Make sure that QTP and the Flight application are open.
STYLE A
STYLE B
Above, after 3rd point, instead of clicking on the "Fly To" combo box, click somewhere in the empty
space above the "Fly From" Combo box but below the line, i.e. in the "Flight Schedule" area.
"Object Selection- Bitmap Checkpoint Properties" window opens up. It will have "WinObject:Flight
Schedule" highlighted. Click ok
It will open "Bitmap Checkpoint Properties" winodow. This time it will have "Flight schedule" area
instead of just the "Fly To" combo box.
Now click on the "Select Area..." button. Mouse pointer will change so that you can select any area by
dragging. Just select "Fly From" combo box by dragging.
Change the "Checkpoint timeout" at the bottom of the window to 0 seconds. so that we will have no
wait time while running the test.
Click ok.
Now you can run the test it will pass. To see how it stores the results, just fail the test. If you have
recorded in the style A then just select any value in the "Fly To" combo box and then run the test. In
the result window on the left hand side when you click on Checkpoint "Fly To:", it will show you the
expected bitmap and actual bitmap on the right hand side. (note: it will show that only in case of Failed
result
On your system under My Documents, there will be a folder named My Pictures, under this you will
will find a folder- Sample Pictures( containing 4 pictures - Blue Hills, Sunset, Winter, Water lilies)
We will run this test with one of the image there- Sunset.
Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Web"
tab and choose first option "Record and run test on any open browser." and click on Ok.
It will open 'Object Selection Checkpoint Properties' window with Image: Sunset highlighted. Click Ok.
It will Open 'Image Checkpoint Properties' Window. In this window just uncheck all the property values
like href, html tag etc and only check last property which is src.
If you run it with that image open in internet explorer it will pass. This test is not intelligent enough. It is
just checking that the image in the explorer is in the same location in which it was when the test was
recorded and its name is Sunset. If you change the name of some other picture in that folder to Sunset
and run the test with that it will also pass.
In this way you can test for some or all the properties of the image which it showed in the 'Image
Checkpoint Properties' Window.
Open a blank test and a web page in offline mode like this below:
1. Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go
to "Web" tab and choose first option "Record and run test on any open browser." and click on
ok.
2. Go to Insert (menu)->Checkpoint->Text Checkpoint.The mouse pointer will become hand
and QTP will be minimized.Click on the first paragraph (which starts with-The page you are
looking..) of that web page.
3. "Text Checkpoint Properties" window opens up. It will show the text to be checked in
"Checkpoint Summary" area in red color and also show in blue color the text which is
displayed before and after the selected text.
4. Click on Configure -here you can change your selected text, change before and after text and
so on, but for now just click ok. At the bottom of the "Text Checkpoint Properties" window
change 'Checkpoint timeout' to 0 seconds. Again Click ok to come out of "Text Checkpoint
Properties" window.
5. Click on stop in order to stop recording.
Run the test and when it is passed just go to the results window and on the left hand side just expand
every option and click on last option Checkpoint "Cannot find server". On the right hand side it will
show you the details. Try to understand those.
In this tutorial we will look at a table Checkpoint just to get familiar with it.
Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Web"
tab and choose first option "Record and run test on any open browser." and click on ok.
The mouse pointer will become hand and QTP will be minimized.
Select "WebTable: Software Testing Life Cycle" which has a table icon on its left, where "Software
Testing Life Cycle" is the name of the table.
Click ok.
'Table Checkpoint properties' window opens. It will show all the rows and columns of the selected
table. This time we will not do any extra setting. Just change the Checkpoint timeout at the bottom of
this window to 0 seconds and click ok .
Run the test and analyze the results in the result window, mainly the checkpoint results to see how
QTP verifies the result. We will manipulate test results in later tutorials.
Now we will make some changes in this one line so that it can return some value.
One thing more we need to do here is that we have to enclose Checkpoint ("FLIGHT") in brackets.
So the final version looks like this:
Dim return
return = Window("Flight Reservation").WinButton("FLIGHT").Check (CheckPoint("FLIGHT"))
msgbox (return)
It can return either true or false i.e. a boolean value. If it passes, it will return true else it will return false
0 comments:
Open a blank test. By default it will have Action1 in it (make sure you are in the keyboard view).
Make sure that Action1 is selected/highlighted and click on the Expert View tab.
In the Expert View type:
msgbox ("my action 1")
Again when you go to keyword View and expand Action1 it will show you function call under it.
In that keyword View itself go to Insert (Menu) ->Call to New Action. 'Insert Call to New Action' Dialog
box opens with Action2 as a default name of a new action. By default it will be added at the end of the
test as this radio button is selected in the location area.
Click ok.
Make sure that Action2 is selected and click on the Expert View tab.
After third action is added, select Action1(keyword view), right click on it and choose 'Action
Properties'.
In the Action properties window that opens, check the 'Reusable action' checkbox at the bottom.
Click ok.
Now again highlight Action3 right click on it and choose 'Insert Call to Existing action'.
'Select action' dialog box appears. In this dialog box in the 'action' dropdown box it will have Action1 by
default since we made only that action as reusable.
In the keyword View where you can see all the three actions, make sure against Action3 it shows "Call
to Action1 action" under Documentation.
Run the test. Three message boxes appear in succession showing 'my action 1', 'my action 2', and
again 'my action 1'.
For this tutorial you need to know VBScript FSO (File System Object).
The main purpose of the FSO is to access the file system of the computer.
Drive
|
Folder
|
Folders
|
File
|
Files
|
Textstream
These above objects have methods and properties. With these above objects you can obtain and work
with the information about drives, folders, files etc like creating a new file, opening a file, writing into a
file and much more.
Here we will see a very simple example how to create a text file from within QTP.
Just write the above text in the expert view of a new blank test and run it. A new text file (testfile.txt)
will be created with "hello world!" written in it.
Try to change the extention of testfile.txt to testfile.doc and see what happens.
2008
You can use regular expressions only for values of type string.
When any special character in a regular expression is preceded by a backslash (\), QuickTest
searches for the literal character.
You can define a regular expression for a constant value, a Data Table parameter value, an
Environment parameter value, or a property value in a programmatic description.
For more common options to create Regular Expressions, see QTP User Guide.
Instead of writing more about QTP regular expressions, lets quickly jump to examples.
Below you will find examples.
[This is just an example using Yahoo mail inbox. Your inbox unread mails may differ from the one
shown in this example]
Browser("Browser").Page("Page").Sync
Browser("Browser").Navigate "https://login.yahoo.com/config/login_verify2?&.src=ym"
Browser("Browser").Page("Yahoo! Mail: The best").WebEdit("login").Set "piyush
Browser("Browser").Page("Yahoo! Mail: The best").WebEdit("passwd").SetSecure
"4801a2cbf793b46aad67194b5cbc961c091f"
Browser("Browser").Page("Yahoo! Mail: The best").WebButton("Sign In").Click
Browser("Browser").Page("Yahoo! Mail - piyush@yahoo.com").Link("Inbox (6)").Click
Now if you don't check any mail in your inbox and log out and then again run this code it will work fine.
But if you check any mail like if I check one mail in my inbox then it will be Inbox(5), then if I run this
code it will fail because the link has changed from Inbox(6) to Inbox(5) and shows the below
mentioned error.
"Cannot identify the object Inbox(6) (of class Link). Verify that this object`s properties match an
object currently displayed in your application."
Now we will change the above code with the help of regular expression so that it will work even if there
is only one unread mail.
Object Repository window will open. Select the object "Inbox(6)". Click on the label Inbox(6) inside
Value column and then click on "<=>" button which will appear.
When you click on the button, it will open 'Value Configuration Options' window. On this window click
on Regular Expression check box. When you click on checkbox it will show warning . Just click on Yes.
Now in the Constant text box inside the displayed window( what I have entered "Inbox \([5-6]\)" and
click Ok and close Object Repository window.
This Regular Expression setting which we have done works for inbox unread mails between 5 and 6
e.g. if your inbox says inbox(5) or inbox(6).
Run the test. It passes for me because I had 5 unread mails in my inbox (inbox(5)).
You can do this setting according to your convenience e.g. [1-5] for unread mails between 1 and 5 and
so on.
We can view the Properties and Methods of any object in an open application with the help of Object
Spy pointing hand mechanism. As we move the pointing hand over the objects in the application, िठर
details get displayed in the Object Spy.
These details displayed in the Object Spy are the hierarchy tree of the test object, its properties and
values, and the methods associated with the object. For methods, the syntax is also displayed.
Step-2: Choose Tools > Object Spy or click the Object Spy toolbar button to open the Object Spy
dialog box and display the Properties tab.
Or click the Object Spy button from the Object Repository dialog box.
Step-4: In the Object Spy dialog box, click the pointing hand which is displayed on top. QuickTest
remains hidden. As we move the pointing hand over the test objects in our application, the test objects
get highlighted, and we can view their test object properties or methods in the Object Spy dialog box.
We can also view their parent objects in the object hierarchy tree area of the Object Spy dialog box.
Step-5: Highlight or click the object whose properties or methods we want to view। The Object Spy
displays the object hierarchy tree and the properties or methods of the object that is selected within the
tree.
Step-6: Click the object whose associated methods we want to view. The Object Spy displays the
object hierarchy tree and details for the selected object according to our selection.
Step-7: To view the properties or methods of the test object, click the Test Object Properties radio
button. To view the properties or methods of the run-time object, click the Run-time Object Properties
radio button.
Step-8: If we want to view properties, values, or methods for another object within the displayed tree,
highlight or click the object in the tree and select the relevant options, as described in step 3 above.
Step-9: If we want to copy an object property or value, or a method’s syntax to the Clipboard, click the
property, value, or method to highlight it. The value gets displayed in the selected property / value or
method syntax box which is located above the Description box. Highlight the text in the box and use
CTRL + C to copy the text to the Clipboard or right-click the highlighted text and choose Copy from the
menu.
0 comments:
First of all you have to connect oracle 9i to QTP 9.(before doing any recording)
• For this go to Insert -> Checkpoint -> Database Checkpoint.
Select ' Specify SQL statement manually' from the Query definition area. Click Next.
• Here click on 'Create' button which is on the right of "Connection String:" It will open 'Select
• Select 'User Data Source' from Select a type of data source. Click Next.
• Select Oracle (on my machine it was 'Oracle in OraHome9'). Click Next. Click Finish.
• Select 'TNS Service Name' ( I selected 'DB02', my oracle database name) from combo box.
• Click 'Test Connection' Button. It will ask for a Password. Enter your password for Oracle.
• If successful it will show 'Testing Connection' window with 'Connection Successful' written on
it.
• Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go
to "Windows Applications" tab and choose first option "Record and run test on any open
Windows based application." and click on ok.
• Go to Insert (menu)->Checkpoint->Database Checkpoint
• Select ' Specify SQL statement manually' from the Query definition area. Click Next. Click
Create.
• Go to 'Machine Data Source' Tab
• Select Oracle from data source name. Click Ok. It will open 'Oracle ODBC Driver Connect'.
• It will come to Database Query Wizard window with 'Connection String' field filled with:
"DSN=oracle;UID=SCOTT;PWD=TIGER;DBQ=DB02;DBA
=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;
LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;
MDI=F;CSR=F;FWC=F;PFC=10;TLO=0;"
• In the SQL Statement area type "select * from emp;". Click Finish.
• It will open 'Database Checkpoint Properties' window with the result of the query. Click Ok.
• In the Expert View, it just adds one line "DbTable("DbTable").Check CheckPoint "DbTable")"
This is the simplest database checkpoint example.
Click on Run. ( we don't need to open any other window or application to run this as our Oracle is
running at the back end as a service - default way in which it was installed- nothing special.)
Test Checkpoint-database Summary (where Checkpoint-database is the name with which I saved the
test)
Run-Time Data Table
Checkpoint-database Iteration 1 (Row 1)
Action1 Summary
DbTable
Checkpoint "DbTable"
( when you click on this, in details it will show checked 112 cells (in your case number of cells may
differ). It means if you go to the oracle and add or delete any row and run this test again it will fail.)
I used Google webpage to create this small tutorial on HP Quicktest Professional. This script will hover
over the mouse cursor inside the search box.(It will not click inside the search box, it will simply bring
the mouse over the search box)
x=Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("name:=q").
GetROProperty("abs_x")
y=Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("name:=q").
GetROProperty("abs_y")
Set obj=CreateObject("Mercury.DeviceReplay")
obj.MouseMove x,y
Please make sure to resize your QTP window and your application before running the above HP QTP
script as shown below to see the effect:
As you have noticed, your
mouse cursor has been shifted to the extreme left corner of the search box. To place it somewhere in
the middle, modify the fourth line in the above script to:
obj.MouseMove x+10,y+10
The output after modifying the QTP script would be as shown below:
1. "abs_x" and "abs_y" are the object's absolute x and y coordinate relative to the screen. Hence we
are finding the extreme top-left coordinate of the search box using the first two lines.
Just like we used MouseMove to shift my mouse cursor over the search box, we can also simulate
clicking on an object using MouseClick.
Hence, if we want to do a left mouse click inside Google search box, our QTP script would be:
x=Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("name:=q").
GetROProperty("abs_x")
y=Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("name:=q").
GetROProperty("abs_y")
Set obj=CreateObject("Mercury.DeviceReplay")
obj.MouseClick x+10,y+10,0
And, if you want to do a right mouse click, replace the last line of above code with the following:
obj.MouseClick x+10,y+10,2
Note: The above code will run successfully if you will resize your QTP window while the script is
running so that the search box is not hidden by the QTP window while the script is running otherwise it
may not work as desired.
Do you have any questions related to this QTP Article? Feel free to ask me. Please post your queries
in the comments section.
'Check for the existence of "Global" sheet inside QTP. Then search for "HPQTP" parameter inside
"Global" sheet
DataTable.GetSheet("Global").GetParameter("HPQTP")
If Err.Number<>0 Then
Msgbox "The specified parameter does not exists"
Else
Msgbox "The specified parameter exists"
End If
Click here to see the script for Checking if Data table sheet exists
I have created a small algorithm to check if a HP QTP DataTable sheet exists or not. The algorithm
goes here:
Step I : Use the On Error Resume Next statement to disable any error popups.
Step II : Use the DataTable's GetSheet method to return the specified sheet. The following syntax
should be used:
DataTable.GetSheet("Your Sheet")
Step III : Check for an error number using Err.Number. If case of no error, Err.Number should return 0.
If Err.Number<>0 Then
Msgbox "The specified Sheet does not exists"
Else
Msgbox "The specified Sheet exists"
End If
Click here to see the script for Checking if Data table Parameter exists
Step I : Use the On Error Resume Next statement to disable any error popups.
Step II : Use the DataTable's GetSheet method to return the specified sheet. Then add the
GetParameter method to seach for the parameter. The following syntax should be used:
DataTable.GetSheet("Your Sheet").GetParameter(" Your Parameter")
Step III : Check for an error number using Err.Number. If case of no error, Err.Number should return 0.
'Check for the existence of "Global" sheet inside QTP. Then search for "HPQTP" parameter inside
"Global" sheet
DataTable.GetSheet("Global").GetParameter("HPQTP")
If Err.Number<>0 Then
Msgbox "The specified parameter does not exists"
Else
Msgbox "The specified parameter exists"
End If
0 comments:
I have created a small algorithm to check if a HP QTP DataTable sheet exists or not. The algorithm
goes here:
Step I : Use the On Error Resume Next statement to disable any error popups.
Step II : Use the DataTable's GetSheet method to return the specified sheet. The following syntax
should be used:
DataTable.GetSheet("Your Sheet")
Step III : Check for an error number using Err.Number. If case of no error, Err.Number should return 0.
If Err.Number<>0 Then
Msgbox "The specified Sheet does not exists"
Else
Msgbox "The specified Sheet exists"
End If
Click here to see the script for Checking if Data table Parameter exists
0 comments: