1Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
1
Building the Login GUI Layer Module
Login Module
2Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
2
Topics covered
Create a new test, and classify it as a reusable action under GUI Layer.
Adding Object to Local Object Repository.
Mapping Dialogs/ Objects. Smart Identification. Modify and save Test Settings.
3Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
3
Before you start…
Before starting the presentation, read about the following topics in QTP help.
Reusable-Actions Smart identification. Action Parameters. Object Spy.
Test Object Properties. Run-time Object Properties.
Object Repository.
4Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
4
Things to Remember…
The Application Under Test (AUT) uses embedded ActiveX objects, so when you first time open QTP, make sure to check ActiveX option from Add-in manager.
When QTP is launched, be sure only the ActiveX option is checked in the add-in manager.
5Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
5
guiLogin Module
Save the current test under name = “guiLogin” in folder FR\RA\GL
guiLogin
LIB
RA
TESTS
RS
DOC
FR
DATSETTING
RES
BATCHENV
Automation
BL
GL
6Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
guiLogin - Introduction
We are going to create a new Test and reusable action.
The Test name would be guiLogin, because it handles the “Login” dialog.
The main action will also called guiLogin. It will be a reusable action, for further tests.
The guiLogin will receive an input parameter of string type.
7Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
7
Modifying the Test Settings - Properties Tab
Description : The guiLogin Module Stores all the actions required for the login processRemark : associated add-ins : ActiveX only
8Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
8
Run Tab
Run one iteration only
Disable Smart IdentificationDuring the run session
Pop upMessage box
Save The Test
9Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
9
Reusable action
We will create Reusable Action named guiLogin and set the Action properties.
The guiLogin module ( reusable action ) implements all the available actions on the Dialog login screen.
The Parameter StepName will be used as an instruction to the reusable action i.e. “SetData”, “CheckLogo” etc.
10Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
10
guiLogin Reusable-Action
From Menu Edit Action Action Properties
11Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
11
guiLogin - General Tab
ChangeActionName
AddDescription
MarkReusable
12Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
12
Parameters Tab – Add StepName Add a new Input Parameter ( Click on + )
AddStepNameInputParameter
TypeString
DefaultLeave Empty
AddDescription
13Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
13
Mapping The Dialog Login
The guiLogin will hold a local repository. The advantage of the OOT (Object Oriented
Testing ) methodology, I think ( and others may disagree with me ) is that by having a reusable action per-screen, you don’t have to maintain a shared object repository.
Especially when you work within a team, it helps sparing the locks on the shared working files.
Mapping the application objects – is very important, you should map your application before you start to “script”
14Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
14
Adding Objects to Local Repository Open the Flight Application from Start All
Programs QuickTest Professional Sample Applications Flight.
Do not login, just leave the window open.
15Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
15
Adding Objects to Local Repository Open the local object repository from
menu Resources Object Repository. Or just type Ctrl+R in QTP application. QTP will show an hand icon.
Click Add objects in toolbarOrObject Add objects To
Local…
16Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
16
Mapping objectsPoint the title-bar of dialog
Click OK
All Objects types
Click OK
17Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
17
Naming conventions All the objects will be added to the local repository. Remove spaces and non-alphanumeric characters
from Object Names. Change “Agent Name:” to “AgentName”. Change “Static” to “Logo”. Remove all names with : (colon ) at the end of the name.
18Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
Why Renaming? Sometimes there are two blanks instead of one; between
two words. According to my experience, nobody will make a new version for such a mistake. Their answer ( R&D ) would be “We will fix it later”.
For QTP this is critical, as it will not identify two spaces instead of one.
The name “Static” says nothing to you and/or your colleagues, but with “logo” you have no doubt.
QTP sometimes gives insignificant names to objects i.e. “button_1” or “button_2”.
It is better to change these, to more descriptive names. Changing logical names does not effect the QTP object
recognition mechanism.
19Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
19
Naming conventions
See the logical namesConvention changes
20Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
20
CheckDialog Reusable Action
We will learn how to check different dialog messages that share same dialog title “Flight Reservation”.
We will create a new reusable action inside the guiLogin module, and we will call it “CheckDialog”.
I will explain later, the considerations of this decision.
21Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
21
Creating a new reusable action From Menu : Insert Call to New Action Type : Hold the ALT key, and type ( I + N ) From toolbar as shown below:
Call to New Action
22Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
22
Adding a new reusable action
Name : CheckDialog Description : Manage all dialog checkpoints under guiLogin
Reusable Action
Location : At the end of the test
23Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
23
CheckDialog Created
Now you should have two reusable actions.
Notice the actions listbox ( left ) and the keyword view ( right ).
24Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
24
Mapping Dialogs Move to Expert View Action CheckDialogs. Open the local repository : Resources Object
Repository Or Type CTRL+R Or from toolbar as shown below:
Object Repository
25Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
25
Mapping Dialogs Open the Flight Reservation application if is not opened,
and click OK. CAUTION : always be aware, specially when adding
objects, that you have only one instance of the AUT open. What would happen? These child objects would be added
under a new “Dialog_2” parent object and would not be recognized during playback.
26Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
26
Map Flight Reservations dialogs Click OK to get Flight Reservations dialog.
27Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
27
Naming Conventions
Remove space between “Flight Reservation” and change it to “FlightReservation".
Change the “static” to “Icon”. Change “Please enter agent name” to “Msg”.
28Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
28
Mapping other dialogs? Return to the same process and add all the objects/
dialog w.r.t. Logging in to Flight Application. Try to map the following dialogs :
Why these are not added to the repository?
29Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
29
Mapping dialogs
That’s because all the messages has the same title “Flight Reservations”.
For QTP all these dialogs are same. Is it good? Of course! Otherwise you will have to
map every single message in your AUT. But, what about the message displayed in the
dialog? The text is not the same. This you will learn through the Object
Identification feature and the Object Spy in next upcoming slides.
30Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
30
Understanding object identification Select the object Spy. From menu : Tools Object
Spy Or from toolbar as shown below.
Object Spy
31Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
31
Object Spy
Click on the finger point and select the message in the dialog.
Save a screenshot of the spy in “My Pictures” and do same for this dialog and compare properties for both the messages.
32Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
32
Object Spy - Msg
33Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
33
Comparing
The properties are quite different. The key of the mystery is the property window id, they are the same = 65535.
34Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
34
Understanding The Object Identification Another look to the repository will show us that the
object is identified by QTP using the native class and window id, those properties have the same values
You will see further, why, this is a very big advantage.
35Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
35
Highlight the Dialogs Messages in the Application
Select the Msg object in the repository and Click the “highlight in application” button while one of the pop-ups is displayed, see what happens.
One by one do the same for other pop-ups, and see what happens.
Highlight in application
36Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
36
Conclusion
Logically, QTP identifies all the messages inside the same dialog as the only one message.
Imagine you have to map all the different messages for same instance of dialog in your AUT. It’s lot of job.
However QTP takes care of it by its Object Identification and Spy feature.
37Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
37
Saving the Test
Save The Test. Every Time you see * near the test name, it
means that the test is not saved. Always remember to save your work.
Not Saved
38Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
38
Summary
We have created a new reusable action guiLogin/guiLogin module
We a created a second new reusable action guiLogin/CheckDialog
In this session we’ve learned how to map the Login window and messages dialogs.
39Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
Special Thanks To Bharathi Babu, India, Pune. Ayyappa Koppolu, India, Pune. Paul Grossman, USA, Chicago. Sumit Singhal, India, Bangalore. Sanjeev Mathur, India, Noida. Manasa VN, India, Bangalore. Prakash Kumar, India, Pune. Richi Sharma, USA, New Jersey. Janardhan Kalvakuntla, USA, New England. Indlamudi Rajesh, India, Mumbai. Joydeep Das, India, Hyderabad.
40Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
4040
Make sure to visit us for: Tutorials Articles Projects And much more
@www.AdvancedQTP.com