Professional Documents
Culture Documents
i
QUICK TEST PROFESSIONAL HANDBOOK
TABLE OF CONTENTS
C:\Documents and Settings\Administrator\Desktop\QUICK_TEST_PROFESSIONAL-
HANDBOOK.doc
1.0 INTRODUCTION.........................................................................................................1
2.0 RECORDING A SESSION...........................................................................................3
3.0 RUNNING A SESSION................................................................................................4
4.0 ACTIONS......................................................................................................................7
4.1 Creating a new action.................................................................................................9
4.2 Inserting an existing action......................................................................................10
4.3 Nesting Actions........................................................................................................11
4.4 Splitting Actions.......................................................................................................11
4.5 Exiting an Action.....................................................................................................12
5.0 OBJECT MANAGEMENT .......................................................................................13
5.1 Object Identification................................................................................................14
5.2 Object Repository....................................................................................................15
5.3 Object Spy ..............................................................................................................17
6.0 CHECKPOINTS..........................................................................................................18
7.0 OUTPUT VALUES......................................................................................................22
Browser("Google").Page("Google").WebEdit("Search").Set "QTP"............................24
Browser("Google").Page("Google").WebEdit("Search").Output CheckPoint("Search")
........................................................................................................................................24
Browser("Google").Page("Google").WebEdit("Search").Submit.................................24
8.0 PARAMETERIZATION..............................................................................................25
8.1 DataTable Parameters..............................................................................................25
8.2 Environment variable Parameters............................................................................27
8.3 Random number Parameters....................................................................................27
9. BEST PRACTICES IN QTP.........................................................................................28
ii
1.0 INTRODUCTION
Advantages:
FEATURE USE
When you run a test, QuickTest performs the steps you recorded on
the application.
• The Run option can be used to run the test from start to end.
• The Run from Step option in the Test menu is used to run the
test from a selected step to the end of the current action, if
running from the Expert View, or to the end of the test , if
running from the Keyword View. Thus it enables us to check a
specific part of the application or to confirm that a certain part
of the test runs correctly.
• The Update Run option in the Test menu is used to update the
Active screens, Checkpoints and the test object descriptions.
While recording, Quick Test saves the snapshots of the
application as Active screens which can be used later to set
Checkpoints and output values.
4.0 ACTIONS
A test is composed of actions or logical sections. The steps we
add to the test are added within the test’s actions. By default, each
test begins with a single action. Dividing a test into actions helps us
to streamline the testing process. When we run a test with multiple
actions, the Test Results are divided by actions so that we can view
the detailed results for each action individually. Each action has its
own sheet in the Data Table so that we can insert data that applies
only to that action.
Actions Tool
Bar
There are two buttons on the Actions Tool Bar, i.e. BACK and
SHOW, as shown below.
Actions List Back Show
The Action Tool Bar will be visible, only when, we have one or more
external/reusable actions in our test. If it is invisible, use View
Tool Bars Action to display it.
1) Click the step after which you want to insert the new action.
6) To insert a new action at the end of the test, check the At the
end of the test checkbox. To insert the new action within the
action of the currently selected step, select After the current
step.
7) Click OK.
All objects recorded for the test are stored in the repository.
The Object Repository displays all objects in the current action or the
entire test. The Object Repository can be used to view or modify the
properties of any object in the reposirory or to add new objects to
the repository. An object in the application can be highlighted using
the Highlight option. A temporary frame appears around the object
causing it to flash. But the application must be open and the object
should be visible in the page. The object spy can also be accessed
from the Repository.
Set the object repository path from Test->Settings->Resource
Tab. Select the repository file with the extension .tsr. If the
repository file is not available create a file with extension .tsr. The
repository path must be set before starting recording.
The Object Repository can be Per Action or Shared.
• The shared repository can be used by multiple actions of the
same test or by actions from different tests. Test object
properties are prone to frequent updation. While adding
existing actions, we can copy an action using the same
Object Repository and Call actions using the same Object
Repository, or Object Repository per action mode
• Per Action object repository is used by one or very few
tests.Test object properties are modified less
frequently.While adding existing actions, if we are using
different object repositories for different actions (One
repository per action) then we can copy or call actions from
tests using Object Repository per Action mode.
Example:
TYPES OF CHECKPOINT
TYPES DESCRIPTION
XML
It checks the data content of XML documents in
CheckPoint
XML documents in the application
• During Editing: Right click the object in the Active screen and
select the type of output value to be added.If the location
clicked is associated with more than one object, then the
Object Selection - Output Value Properties dialog box opens.
From here select the required object.
Example
Browser("Google").Page("Google").WebEdit("Search").Set "QTP"
Browser("Google").Page("Google").WebEdit("Search").Output
CheckPoint("Search")
Browser("Google").Page("Google").WebEdit("Search").Submit
Browser("Google ").Page("QTP").Sync
8.0 PARAMETERIZATION
Example
Consider parameterising the search string in the home page of
Google.Each time you want to search for a different string. Enter the
search string in the datatable and change the code as follows
Browser("Google").Page("Google").WebEdit("Search").Set
Datatable.Value("SearchString")
Browser("Google").Page("Google").WebEdit("Search").Submit
These scripts can be reused for all the applications with slight
modification relative to project and application needs. These scripts
can be used to run the test automatically without Manual
Intervention in setting the initial Steps.
Task Scripts
To open the
application without
Invoke Application “Path of Application”
configuring in the
Record & Run
settings
configuring ("QuickTest.Application")
To change the
values of
environment
variables in the Environment.Value(“VariableName”)=”SetNewVal
test the following ue”
code can be used.
This is applicable
only for previously
created
Environment
variables.
‘Creating HTML file
Dim fso,Myfile
The results in the Set fso=
Test results window CreateObject("Scripting.FileSystemObject")
can be stored in a Htmlfilename = “Path of File”
HTML file for future Set MyFile =
reference. This can fso.CreateTextFile(Htmlfilename,true)
serve as a valuable MyFile.Close
deliverable to the ‘Opening the file in Different modes
client. This can be Dim objStream
achieved through Set objStream=fso.OpenTextFile (Htmlfilename,
the following code. ForWriting)
The Test Case Set objStream= fso.OpenTextFile (Htmlfilename,
Name, Actual results ForReading)
and Expected Set objStream= fso.OpenTextFile (Htmlfilename,
Results can be ForAppending)
stored as ‘Writing\Appending to the file
environment objStream.WriteLine("<html><body>Results
variables and can be HTML
modified to suit the File</body></html>")
need. objStream.WriteLine("<table><tr>
<td>Test CaseName</ td>
<td>Expected Result</td>
<td>Actual Result</td>
<td>Status</td></tr></table>")
objStream.Close
‘Sets the value of the Search Textbox
To set and get the Browser ("Google").Page ("Google").WebEdit
test object property ("q").
values SetTOProperty "value","QTP"
‘Gets the value of the Search Textbox
Val=Browser("Google").Page("Google").WebEdit
("q").
GetTOProperty("value")
Function
SendMail(SendTo,Subject,Body,Attachment)
Set ol = CreateObject("Outlook.Application")
Set Mail = ol.CreateItem(0)
QTP can be Mail.to = SendTo
programmed to Mail.Subject = Subject
send a mail to Mail.Body = Body
outlook regarding If (Attachment <> "") Then
the Status or Mail.Attachments.Add(Attachment)
completion of the End If
test run. The Mail.Send
following code can ol.Quit
be deployed Set Mail = nothing
Set ol = nothing
End Function
SendMail
"Suresh@OrangeITIndia.com",TestCaseName,
Status,"Attachment"