hp quicktest professional: advanced function libraries

23
1 ©2010 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice HP QuickTest Professional: Advanced Function Libraries Jay Roessler Founder and Principal Consultant, JRC, LLC

Upload: hp-software-solutions

Post on 02-Jun-2015

530 views

Category:

Documents


1 download

DESCRIPTION

Although HP QuickTest Professional (QTP) provides a wealth of useful built-in function libraries, its function libraries are limited to elementary capabilities. Attend this session and learn how to overcome this limitation by creating predefined, advanced generic and application-specific function libraries to support robust and flexible test automation – a critical component to achieving advanced, mature test automation.

TRANSCRIPT

1 ©2010 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice

HP QuickTest Professional: Advanced Function Libraries

Jay RoesslerFounder and Principal Consultant, JRC, LLC

Advanced Function Libraries

Agenda

• Automation maturity

• Center of Excellence (CoE)

• Generic functions

• Application specific functions

• Documentation

Automation Maturity

Level 1

Level 2

Level 3

• Fully mature process/test environment/architecture

• Data/keyword driven, Business Process Testing

• Well structured/organized function libraries

• Full documentation

• Moderately mature process/test environment/architecture

• Beyond record & playback, some data driven

• Poorly structured/organized function libraries

• Some documentation

• Immature process/test environment/architecture

• Record & playback

• No function libraries

• Little/no documentation

CoE

Center of Excellence (CoE)

• Key factors that contribute to achieving

CoE success

– Fully mature automation architecture

– Well structured/organized function libraries

– Full documentation

Advanced Function Libraries

Core Elements

Generic functions/subroutines

Application specific functions/subroutines

Global constants, variables, and objects

Advanced Function Libraries

Generic Functions

• Relative date math and format specification

– Relative date math (today + 30 days, today)

– Specify common formats (ie; JUN 18, 2010)

add_days = 0 ' today's date just in a new format

date_new_format = "MMM DD YYYY"

msg = "add " & add_days & " days to today's date = " & _

today_plus_days (add_days, date_new_format)

msgbox msg

Advanced Function Libraries

Generic Functions

• Date format conversion

date_in = "20100618"

date_in_format = "YYYYMMDD"

date_out_format = "MMMM DD, YY"

msg = "date_in = " & date_in & vbcrlf

msg = msg & "date_in_format = " & date_in_format & vbcrlf

msg = msg & "date_out_format = " & date_out_format & vbcrlf

msg = msg & "converted date = " & convert_date_format _

(date_in, _

date_in_format, _

date_out_format)

msgbox msg

Advanced Function Libraries

Generic Functions

• Julian date format conversion

For i = 0 to 366

date_ = dateadd("d", i, "06/18/2010")

msg = msg & date_ & " = " & _

jbl_convert_date_to_julian (date_) & vbcrlf

Next

msgbox "julian dates for input date format mm/dd/yyyy" & _

vbcrlf & vbcrlf & msg

Advanced Function Libraries

Generic Functions

• Regular expression support

– String comparison

str1 = "xyz"str2 = "regexp:=x.*"

rc = jbl_str_compare (str1, str2)

msg = "str1 = """ & str1 & """" & vbcrlf

msg = msg & "str2 = """ & str2 & """" & vbcrlf

msg = msg & "str1 = str2 ? " & rc

msgbox msg

Advanced Function Libraries

Generic Functions

• Regular expression support

– Custom object property text verification

set sap_win = SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access")

verify_desc = "Window Title"

reg_exp_text_to_verify = "SAP Easy Access.*"

sap_win.jbl_verify_obj_text verify_desc, reg_exp_text_to_verify

Advanced Function Libraries

Generic Functions

reg_exp_text_to_find = "ims.*[0-9]"

ignore_case_flag = JBL_IGNORE_CASE

find_all_flag = true

selected_te_screen_text = TE_SCREEN_OBJ.gettext 1,1,24,80

dim indexes_arr()

total_found = jbl_instr_reg_exp (reg_exp_text_to_find, _

selected_te_screen_text, _

ignore_case_flag, _

find_all_flag, _

indexes_arr)

For y = 0 to ubound (indexes_arr)

msg = msg & "found position: " & indexes_arr(y,0) & vbcrlf

msg = msg & "string found: " & indexes_arr(y,1) & vbcrlf

msg = msg & "length string: " & indexes_arr(y,2) & vbcrlf

Next

msgbox “number found = " & total_found: & vbcrlf & msg

• Regular expression support, extend VBScript’s instr() function

Advanced Function Libraries

Generic Functions

• BPT enhancement to manage data entry– Default value special identifiers

• Optional

• Required

• Unique value

Advanced Function Libraries

Generic Functions

• BPT enhancement to manage data entry– Uses custom methods overrides

• <edit obj>.Set

• <combobox/list type obj>.select

• <table/grid obj>.SetCellData

• Use registeruserfunc to override the QTP’s Set, Select, and SetCellData

Advanced Function Libraries

Application Specific Functions

Enter, Set,

Update

Find by

Search

Verify Get Delete

Single,

Multiple

Rows

Yes Yes Yes N/A Yes

Columns Yes N/A Yes N/A N/A

Single,

Multiple

Cells

Yes N/A Yes Yes Yes

• Table/Grid operations– Generic functions eliminate custom coding for

common operations

Advanced Function Libraries

Application Specific Functions

• Table/grid function architecture

Excel based operations

Primary operations by search

Core supporting functions

Advanced Function Libraries

Application Specific Functions

• Table/grid functions

Excel based operations

enter_grid_data

manage_grid_data

Primary operations by search

delete_rows_by_search

get_cell_by_search

select_rows_by_search

update_cell_by_search

verify_cell_by_search

verify_cell_number_by_search

Core supporting functions

delete_rows

enter_grid_data

enter_grid_data_by_col

enter_grid_data_by_row

find_all_rows_by_search

get_update_verify_cell_by_search

update_grid_data

update_grid_data_by_col

update_grid_data_by_row

Advanced Function Libraries

Application Specific Functions

• Table/grid functions– Uses column name/value pairs

– Use data sheets (*.xls) stored in QC or file system

– Supports relative date math

– Supports optional, required, unique value data entry special identifiers

– Supports number, text, and expression verification

• Use registeruserfunc to add new methods to grid/table objects

Advanced Function Libraries

Global Constants, Variables,

and Objects

• HTML reporting enhancements

• Global test settings

• User defined error codes

• Regular expression processing

Advanced Function Libraries

Documentation

• Comment functions

• Help file (*.chm)

– Developer’s guide

– Function/sub-routine reference

– Code and usage samples

– Revision history

– Known issues

– Searchable, Indexed

Advanced Function Libraries

Outcomes

• Reduced automation development time

• Functions and subroutines are reusable

• Improved stability since functions and

subroutines are rigorously tested

• Easier maintenance

• Common architecture

Q&A

22 ©2010 Hewlett-Packard Development Company, L.P.

To learn more on this topic, and to connect with your peers after

the conference, visit the HP Software Solutions Community:

www.hp.com/go/swcommunity

23