Flight Reservation Module
description
Transcript of Flight Reservation Module
![Page 1: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/1.jpg)
Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
1
Flight Reservation Module
Implementation of Flight Reservation
![Page 2: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/2.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 2
Topics covered
Exporting Data-tables. Checkpoints and CheckProperty method. Testing ActiveX test objects. Mapping objects using filter. Implementation of
Req0010 to Req0015
![Page 3: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/3.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 3
Before you start…
Before starting the presentation, read about the following topics in QTP help. WinObject object. ActiveX object. Run-time properties. WinMenu.CheckItemProperty method. ExitActionIteration statement. WinMenu.ExpandMenu property. WinMenu.BuildPath method. DataTable object.
![Page 4: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/4.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 4 4
guiFR Module
Open a new blank test and save it as “guiFR” under the folder FR\RA\GL
guiFR
LIB
RA
TESTS
RS
DOC
FR
DATSETTING
RES
BATCHENV
Automation
BL
GL
![Page 5: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/5.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 5
guiFR - Introduction
We are going to create a new test, classified as a GUI module, and a reusable action.
The module name would be guiFR, because it will handles the “Flight Reservation” window.
This action will be called GuiFR because the reusable action is going to handle all the operations on FR windows .
The guiFR will receive a single input parameter (StepName) of String type.
As you might have noticed in previous presentations all guiXX actions have one and only one input parameter.
![Page 6: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/6.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 6 6
guiFR Settings
From Menu Edit Action Action Properties
![Page 7: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/7.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 7 7
guiFR - General Tab
ChangeActionName
AddDescription
MarkReusable
![Page 8: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/8.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 8 8
Parameters Tab – Add StepName Add a new Input Parameter ( Click on + )
AddStepNameInputParameter
TypeString
DefaultLeave Empty
AddDescription
Click OK
![Page 9: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/9.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 9 9
Adding Objects to Local Repository Open the Flight Application from Start All Programs
QuickTest Professional Sample Applications Flight. Login to FR.
![Page 10: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/10.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 10 10
Adding Objects to Local Repository Open the local object repository from
Menu Resources Object Repository. Or just press < Ctrl + R > in QTP application. Click Add objects in toolbar or select Object > Add objects
to local repository from menu-bar. QTP will show an hand icon.
Click Add objects in toolbarOrObject Add objects To
Local…
![Page 11: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/11.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 11
Mapping objects
Select The
Window Title
With the point hand
Verify WinObject is unchecked under Miscellaneous
![Page 12: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/12.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 12
Mapping Objects
![Page 13: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/13.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 13 13
Naming conventions
All the objects will be added to the local repository.
While mapping the FR window we can see how naming conventions can be effective.
Which button is Button_2? and Button_4? Which object is MaskEdBox?
Rename all objects; use the “Highlight in Application” and “Locate in Repository” features.
When an object was located, right-click on the object logical name ( left pane ) and select “Rename”.
![Page 14: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/14.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 14 14
Naming conventions
Compact View
Extended View
![Page 15: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/15.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 15
guiFR Header
'***********************************************************************
'@Author : advancedQTP
'@Date Created : <ddd MMM dd, yyyy>
'@QTP Version : 9.2
'@Description : The guiFR Module Stores all the actions required for the Main screen.
'@Input Parameter : Name:=StepName, Type:=String, Default:=, Description:=The Step code name.
'@Out Parameter : None.
'@Gui Window : Window "Flight Reservation"
'@Addins : ActiveX
'@Modifications : <#n By <Name>, Date: <dd-mmm-yyyy>> (Later modification on top)
' <#n-1 By <Name>, Date: <dd-mmm-yyyy>
'***********************************************************************
Option Explicit
![Page 16: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/16.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 16
guiFR Template
Option Explicit
Dim msg
Select Case LCase( Parameter.Item( "StepName" ) )
Case ...
Case ...
Case Else
Reporter.ReportEvent micWarning, "NotImplementedException", Parameter( "StepName" )
ExitAction( micWarning )
End Select
![Page 17: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/17.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 17
Implementing Req0010
There are 6 bitmap checkpoints and 6 property checks.
It is not possible to merge a bitmap checkpoint to a Standard checkpoint, so we are going to use the CheckProperty method of the WinButton object.
![Page 18: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/18.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 18
Implementing Req0010
Add a new “Case” to the Select Case statement. Remember to use lower-case since the Select
Case condition is converted to lower case ( LCase Function )
![Page 19: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/19.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 19
Req0010 – Bitmap Checkpoints To insert a bitmap checkpoint we must be in “Record”
mode. Before pressing RECORD, place the cursor below the
Case “req0010” be sure only one instance of “Flight Reservation” application is opened.
Put the cursor on line 19 ( just below case “req0010” )
Avoid This!!!
![Page 20: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/20.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 20
Name: Req0010a
Timeout : 2
Inserting a Bitmap Checkpoint Be sure you are in Recording Mode ( Status Bar Message blinking ) Select from menu : Insert Checkpoint Bitmap checkpoint. With the pointing hand, select the “New Order” button. Then without stopping continue to the rest of buttons one after
another.
![Page 21: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/21.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 21
Req0010 - Implementation
Place the cursor below the last checkpoint and press F7.
You will see the step generator. Category : Test Objects. Click the object icon on right.
![Page 22: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/22.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 22
Req0010a – Using the Step Generator
Name: NewType: Button
![Page 23: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/23.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 23
Req0010a – Using the Step Generator
Operation:
CheckProperty
Documentation:
Click For Documentation
PropertyName:
enabled
PropertyValue
True
Timeout
2000
![Page 24: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/24.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 24
Step Generator…
For some reason the Step Generator, converts “Any” values to string. So we need to fix the strings “True” to Boolean True.
Repeat above steps for rest of the bitmap checkpoints.
Fix Manua
lly
![Page 25: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/25.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 25
Checkpoints
Place the cursor below the checkpoint created for “req0010b” and press F7.
Repeat Steps discussed from slide # 21 to 24. Repeat above steps for rest of the bitmap
checkpoints. Do not forget to change string “True” to boolean
TRUE and for Delete “PropertyValue” should be FALSE.
![Page 26: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/26.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 26
Req0010 Case - Modifying
Modify Script for better look and fit to code standards
![Page 27: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/27.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 27
Req0010 Case – Keyword View
![Page 28: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/28.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 28
Implementing Req0011
Req0011 checks also the properties of the “Date of Flight” field.
The “Date of Flight” field is an ActiveX object we have to test 5 properties.
“Flight From” and “Flight To” has two properties to be tested. To test these 2 properties we will use standard checkpoints.
![Page 29: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/29.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 29
Implementing Req0011
Press on record, and insert a standard checkpoint for this object.
![Page 30: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/30.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 30
Implementing Req0011a Rename the checkpoint to “Req0011a” and only check the
required properties
![Page 31: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/31.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 31
Modifying Checkpoints
If you find that you made a mistake on selecting properties you can always edit you checkpoints.
Select the word “Checkpoint” and right-click. In the popup menu select “Checkpoint Properties…”
![Page 32: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/32.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 32
Implementing Req0011b and Req0011c. Add a standard checkpoint for “Fly From” and “Fly To”. Give the name “Req0011b” and “Req0011c” respectively.
![Page 33: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/33.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 33
Implementing Req0011d
Since Req0011d checks only one property, we will insert the checkProperty method manually or via “Step Generator” .
Use QTP intellisense when typing.
![Page 34: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/34.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 34
Implementing Req0012
![Page 35: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/35.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 35
Implementing Req0012
All the fields from “a” to “i” except “e” are disabled all the time, they are just information fields.
The thing that we need to test here is not that fields should be enabled but that fields are not displaying any data, all fields should be empty.
![Page 36: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/36.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 36
Implementing Req0013
![Page 37: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/37.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 37
Implementing Req0013
![Page 38: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/38.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 38
Implementing Req0013 – Menu Defaults We are checking the WinMenu object. To check a menu item, we are going to use the CheckItemProperty
method because it is not supported by any standard checkpoint. Menu item exists.
Window( “FR” ).WinMenu( “Menu” ).CheckItemProperty “<item>”, “Exists”, True, 2000
Menu item enabled. Window( “FR” ).WinMenu( “Menu” ).CheckItemProperty “<item>”, “Enabled”, True, 2000
Menu item index. Window( “FR” ).WinMenu( “Menu” ).CheckItemProperty “<item>”, “Index”, <n>, 2000
Menu item label. Window( “FR” ).WinMenu( “Menu” ).CheckItemProperty “<item>”, “Label”, <label>, 2000
Menu item SubMenuCount. Window( “FR” ).WinMenu( “Menu” ).CheckItemProperty “<item>”, “SubMenuCount”,
< count >, 2000
![Page 39: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/39.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 39
Implementing Req0013 – Menu Defaults We need to “check” 15 menu items and 7 properties each
( 105 lines of code ). We can repeat the code ‘7’ times, for each menu item; that
will work, but, it will require a lot of coding, and if, in the future, something changes in Menu, then it will require more time in maintenance.
For this specific requirement I have chosen a “smart” method.
I will create an excel sheet with the expected results and use the QTP iteration mechanism, so now, the only thing left is to maintain an excel-sheet, and not the code.
Earlier we learned how to import an excel sheet, now we’ll see how to export an excel sheet.
Select the Local Sheet “guiFR”
![Page 40: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/40.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 40
Req0013 Process Design
<n> Rows
Exists?Y
Start
Exists
Loop
<rows>
Enabled?
Failed
Y
Label?
Enabled
Label
Index? Index
Y
HasSubMenu? HasSubMenu
SubMenuCount? SubMenuCountY
Y
Y
< CHECK >Index :
![Page 41: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/41.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 41
Req0013 Process Design
<n> Rows
Exists?Y
Start
Exists
Loop
<rows>
Enabled?
Failed
Y
Label?
Enabled
Label
Index? Index
Y
HasSubMenu? HasSubMenu
SubMenuCount? SubMenuCountY
Y
Y
< CHECK >Index :
![Page 42: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/42.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 42
Exporting a Data-Sheet If you don’t see the Data Table select from menu View Data Table
Or from the toolbar as shown below.
View Data Table
![Page 43: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/43.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 43
Inserting a new Data-Column
You can insert/change the name of a column for a parameter by double-clicking the column heading cell.
![Page 44: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/44.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 44
Inserting a new Data-Column
Add the follow columns : “itemPath”, “menuItem”, “Exists”, “Enabled”, “HasSubMenu”, “Index”, “Label”, “SubMenuCount”
![Page 45: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/45.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 45
Exporting Data Table
![Page 46: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/46.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 46
Modifying Datasheet Open FR\DAT\FR.xls Delete line no. 2 ( remove the cell frames ) Rename sheet to “MenuDefaults” You can optionally remove “Sheet2” and “Sheet3”
![Page 47: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/47.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 47
Entering Data
![Page 48: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/48.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 48
Excel Options
When I first wrote the excel file and run it, I found something very strange. My checkpoint failed with the following message :
If you have a sharp eye you can notice a minor difference..
If you still didn’t notice the difference, I'll tell you; the expected 3 dots, are wider than the actual 3 dots...mmmm
![Page 49: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/49.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 49
Excel Options I researched, and almost got crazy, but then I found a
solution. The last 3 dots are NOT 3 characters, “those” are actually a
single “symbol” character.
And why is it a 'single symbol' character? Because that is the way microsoft has designed it.
![Page 50: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/50.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 50
Excel Options
If you just type the string “Open Order...” in MS-Excel and press ENTER, you will see the following difference:
And not
The difference can be seen in better in “Courier New” font. That’s the main reason that I recommend to use the
“Courier” or “Courier New” fonts. The AutoCorrect feature is defined by default to change
the 3 dots. Select in Excel menu : Tools > AutoCorrect Options... >
AutoCorrect Tab Uncheck the option “Replace text as you type”.
![Page 51: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/51.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 51
Implementing Req0013
Add a new Case “req0013”. Remember to use lower-case.
![Page 52: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/52.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 52
Implementing Req0013
Notice that we have left some cells empty in the excel sheet. According to SRS document the properties that we don't need
to check are left empty. The idea is to “check” data, only if the content of the cell is
not empty.
If DataTable( "< column name >", dtLocalSheet ) <> "" Then
' ** CheckItemProperty...
End If
![Page 53: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/53.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 53
Implementing Req0013
Declare the variables that we’re going to use. Reporting the current checked menu item. Activate the FR Window.
Case "req0013"
Dim itemPath, bExists
Reporter.ReportEvent micDone, "Menu Item", DataTable( "menuItem", dtLocalSheet )
Window( "FR" ).Activate micLeftBtn
QTP Help : "Note: For better performance when running your test, you may want to set the ExpandMenu property to False"
Window( "FR" ).WinMenu( "Menu" ).ExpandMenu = False
![Page 54: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/54.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 54
Implementing Req0013
Retrieving the item path.
itemPath = Window("FR").WinMenu("Menu").BuildMenuPath( DataTable("itemPath",dtLocalSheet))
First, we want to verify if we need to check the property “Exists”, by checking if column “Exists” is not empty.
Instead of vbNullString you can use " ". I think that vbNullString is more “elegant”.
If DataTable( "Exists", dtLocalSheet ) <> vbNullString Then
End If
![Page 55: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/55.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 55
Implementing Req0013 - CheckItemProperty
Put the cursor after the If statement and press F7 to open the Step Generator.
Select Menu
Test Objects
![Page 56: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/56.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 56
Implementing Req0013 - CheckItemProperty
CheckItemProperty 1. Parameter = Constant
2. itemPath
![Page 57: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/57.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 57
Implementing Req0013 - CheckItemProperty
CheckItemProperty 1. Parameter = Constant
2. Constant = Exists
![Page 58: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/58.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 58
Implementing Req0013 - CheckItemProperty
CheckItemProperty 1. Parameter = DataTable
2. Current action sheet
3. Name = Exists
![Page 59: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/59.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 59
Implementing Req0013 - CheckItemProperty
1. Timeout = 2000
2. Return value = bExists
![Page 60: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/60.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 60
Modifying...
"itemPath" is a variable not a string. Manually modify the value.
Similarly change string “itemPath” to variable itemPath for the rest of the properties or insert the statements manually using QTP intellisense.
![Page 61: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/61.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 61
Applying With…End With Statement
It is possible to apply “With....End With” statements automatically to the scripts.
However it is not recommended, because QTP’s intellisense feature does not work then.
This is a bug in QTP. However you can try to apply “With....End With” by selecting from menu Edit Advanced Apply with "With" to script, or just press < Ctrl + W >. see what happens!
You can restore to previous state by typing < Ctrl + Shift + W > If you have to apply “With....End With” to a specific area, you
will have to do it manually. If intellisense would also works with “With....End With”
statement, it will be a great advantage, as the statements make code more readable.
![Page 62: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/62.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 62
Requirement Req0013 – Final Look
![Page 63: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/63.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 63
Requirement Req0014 and Req0015
![Page 64: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/64.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 64
Implementing Req0014
In the Summary Frame we need to check 2 objects. Those are 2 CheckProperty methods.
Use QTP intellisense to complete the commands.
![Page 65: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/65.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 65
Implementing Req0015
Req0015 is just a bitmap checkpoint to the image. Since the image is not in the repository we need to add it. To open the local repository type Ctrl + R.
![Page 66: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/66.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 66
Inserting a single object to Local Repository
Add objects to Local
Select with the finger point the image.
![Page 67: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/67.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 67
Inserting a single object to Local Repository
Change "Static" to "Image"
![Page 68: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/68.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 68
Implementing Req0015
Insert a bitmap checkpoint. Start recording, and remember, only one instance of the Flight Reservation application should be opened.
Stop recording after inserting the bitmap checkpoint.
![Page 69: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/69.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 69
Req0015 – Final Look
A good practice is to Activate the window before a bitmap checkpoint.
![Page 70: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/70.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 70
What’s Next?
We have already seen how to implement a single test for each requirement.
In next presentation we are going to learn a different method; To test a group of requirements ( GUI Defaults ) in a single test.
We call it the Keyword-Data Driven method.
![Page 71: Flight Reservation Module](https://reader031.fdocuments.net/reader031/viewer/2022013004/56813ecb550346895da93650/html5/thumbnails/71.jpg)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 71 71
Make sure to visit us for: Tutorials Articles Projects And much more
@www.AdvancedQTP.com