Professional Documents
Culture Documents
QTP Framework Description SAP
QTP Framework Description SAP
Version 1.0
June 2009
DISCLAIMER Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this notice is preserved.
Table of Contents
TABLE OF CONTENTS
1. PURPOSE
1.1. 1.2.
OF THE
DOCUMENT ........................................ 4
2. 3.
4.
5.
FUNCTIONS
5.1. 5.2.
................................... 18
Function for setting the context: ............................... 18 Function for setting the object: ................................ 19
AND
6.
REPORTING
6.1. 6.2.
7.
STRING
7.1. 7.2. 7.3. 7.4.
Function for string operations: ................................. 24 Function for Regular Expression Test: ........................... 25 Function for Regular Expression Match: .......................... 25 Function for Regular Expression Replace: ........................ 26
8. 9.
Open2Test.org
Page ii
Table of Contents
9.8. 9.9. Function for Folder Operations .................................. 34 Function for File Operations .................................... 35
9.10. Function for Exporting XMLs ..................................... 36 9.11. Function for Deleting XMLs ...................................... 37
11. CONDITION
AND
Open2Test.org
Page iii
1.
1.1.
Scope
The scope of this document is to provide details about Open Source Test Automation Framework code.
1.2.
Overview
This document provides details about: Framework Architecture Driver Function Action Functions Reusable Functions Common Functions User-defined Functions
Open2Test.org
Page 4
2.
Open2Test.org
Page 5
3.
3.1.
Driver Functions
Keyword Driver Function
Name of the function: Keyword_Driver () Description: This function is used to call the main framework. Parameters: NA Assumptions: The automation script is present in the global sheet of HP QuickTest Professional (QTP). Variables: a) intRowCount - This variable is used as a counter to loop through all the data table rows. b) intDataCounter This variable is used to store the iteration count for looping. c) intSheet This variable is used to check whether the keyword script is present in the global sheet. Functionality: The Driver function reads the values in the first column of the global sheet. Whenever the (Keyword_SAP). value is r, it calls the main function
When r is not present in the first column, it will skip the row and read the value in the next row. If the global sheet is empty then it reports fail, stating Script is not present in the global sheet.
3.2.
Main Function
Name of the function: Keyword_SAP () Description: This is the main function, which interprets the keywords and performs the desired actions. All the keywords used in the data table are processed in this function. Parameters: NA Assumptions: The automation script is present in the global sheet of QTP. Variables: a) initial This variable is used to store the value in the second column. b) objName This variable is used to store the value in the third column. c) arrAction() This array is used to store the object type and name. d) objPerform This variable is used to store the value present in the fourth column.
Open2Test.org
Page 6
Open2Test.org
Page 7
4.
4.1.
Action Functions
Perform Function
Name of the function: Func_Perform () Description: This function required object in the AUT. Parameters: a) parent This is the parent to the object on which the specified operation needs to be performed. b) object This is the object on which the specified operation needs to be performed. c) arrObj This parameter holds the type of the object and the object name on which the action has to be performed. d) arrKeyValue This parameter identifies the operation that needs to be performed on the object. e) arrKeyIndex This additional parameter is required to identify the object where the operation needs to be performed. It holds the value of the specific action type and the value to be used, with row and column values for table operations. f) intRowCount This parameter holds the count of the current row in the data table. Assumptions: NA Variables: a) intFlag Flag used for checking the table contents b) intExpFlag Flag used for checking the table contents c) intTableRowCount Variable used to store the number of rows in a table d) strCellValue Variable used to store the cell contents of a table e) intI Variable used as a counter for checking the table contents f) arrStatus This variable is used to store the split array of propSplit1(0) when delimiter '_' is used. g) propSplit1 This variable is used to store the split array of the fourth column of the data sheet when delimiter '_' is used. h) VarName This variable is used to store the value present in arrStatus(0). i) strparam2 This variable is used to store the value present in the fifth column of the datasheet. Functionality: Based on the values in arrObj(0), Func_Perform() performs different actions on objects. If the value is: 1. button Based on the values different actions on arrKeyValue(0) is: in arrKeyValue(0) the function objects. If the value in the performs variable performs the set of actions on the
Open2Test.org
Page 8
a. setdate: Sets the date of the calendar object based on the value in the variable arrKeyValue (1) viz: i. <date>: Sets the date in the calendar to specified date ii. date: Sets the date in the calendar to current date b. click: Performs click operation on the object 3. codebox Based on the values different actions on arrKeyValue (0) is: in arrKeyValue(0) the function objects. If the value in the performs variable
a. set: Sets the value present in arrKeyValue(1) in the current object b. click: Performs click operation on the current object 4. checkbox Based on the values different actions on arrKeyValue (0) is: in arrKeyValue(0) the function objects. If the value in the performs variable
a. check: Sets the current object to ON state b. uncheck: Sets the current object to OFF state 5. combobox Based on the values in arrKeyValue(0), the function different actions on objects. If the value in the arrKeyValue (0) is: performs variable
a. select: Selects the item, specified by variable arrKeyValue(1), from the combobox object. b. selectindex: Selects the item with index, specified by variable arrKeyValue(1), from the combobox object. 6. dialog Based on the values in arrKeyValue(0), the function different actions on objects. If the value in the arrKeyValue (0) is: a. close: Closes the parent object b. restore: Restores the parent object c. activate: Activates the parent object 7. editor Based on the values in arrKeyValue(0), the function performs different actions on objects. If the value in the variable arrKeyValue (0) is: a. set: Sets the value specified in arrKeyValue(1) in the current object b. click: Performs a click operation on the object c. doubleclick: Performs a doubleclick operation on the object performs variable
Open2Test.org
Page 9
a. rowsearch: Performs a search on a table for the text specified in arrKeyIndex(2) using the FindRowByCellContent method and returns the row number, which is stored in a variable with the name specified in arrKeyIndex(3) b. tablesearch: Calls the function Func_TableSearch variable object passed as an argument 9. label Based on the values different actions on arrKeyIndex(0) is: in arrKeyIndex(0) the function objects. If the value in the performs variable with the
a. setfocus: Sets the focus on the current object b. setcaretpos; Sets the curser position to the position specified in the variable arrKeyValue(1) 10.listbox Based on the values different actions on arrKeyIndex(0) is: in arrKeyIndex(0) the function objects. If the value in the performs variable
a. select: Selects the item specified in arrKeyValue(1) from the current object using the Select method b. click; Performs click operation on the current object c. deselect; Deselects the item specified in arrKeyValue(1) from the current object using the Deselect method d. extendselect; Selects an additional item specified in arrKeyValue(1) from the current object using the extendselect method 11.menu Based on the values different actions on arrKeyValue(0) is: in arrKeyValue(0) the function objects. If the value in the performs variable
a. select: Selects the item specified in arrKeyValue(1) from the current object using the Select method b. click: Performs click operation on the current object 12. navigationbar Based on the values different actions on arrKeyIndex(0) is: in arrKeyIndex(0) the function objects. If the value in the performs variable
a. select: Selects the item specified in arrKeyIndex(1) from the current object using the Select method b. click: Performs the click operation on the current object c. hide: Hides the current object d. show: Shows the current object e. expand: Expands the item specified in arrKeyIndex(1) from the current object using the Expand method
Open2Test.org
Page 10
a. select: Selects the item specified in arrKeyIndex(1) from the current object using the Select method b. click: Sets the focus on the current object c. selectindex: Selects the item with the index specified in arrKeyIndex(1) from the current object using the Select method 17. textbox Based on the values in arrKeyValue(0), the function performs different actions on objects. If the value in the variable arrKeyValue(0) is: a. set: Sets the value specified in arrKeyValue(1) in the current object Also it checks whether the user needs to enter a date. It sets the date value depending upon the value in the variable arrstatus(0). The date values can be set using the following: currenttime: This sets the current time in the object. currentdate: This enters the current date in the current object. y: This enters the date in a custom format. d: This enters the current date in a custom format. m: This enters the date in a custom format.
Open2Test.org
Page 11
b. setvalue: Sets the value specified in variable arrKeyIndex(3) in a particular cell of the table specified, with the row number stored in variable arrKeyIndex(1) and the column name specified by arrKeyIndex(2) c. getrow: Performs a search for text specified in variable arrKeyIndex(2) on all the rows under the column specified by valriable arrKeyIndex(1) and then returns the row number where the text is found, which is then stored in a variable with the name specified by arrKeyIndex(3) d. selectrow: Performs a search for text specified in variable arrKeyIndex(2) on all the rows under the column specified by valriable arrKeyIndex(1) and then selects the row where the text is found e. setindexvalue: Sets the value specified in variable arrKeyIndex(3) in a particular cell of the table specified, with the row number stored in variable arrKeyIndex(1) and the column number specified by arrKeyIndex(2) 19. toolbar Based on the values in arrKeyValue(0), the function performs different actions on objects. If the value in the variable arrKeyValue(0) is: e. press: Performs Press operation on the item of the toolbar specified by the variable arrKeyIndex(1) using the PressButton method 20. treeview Based on the values in arrKeyValue(0) it performs different actions on objects. If the value in the variable arrKeyValue(0) is: a. expand: Expands the node, specified by variable arrKeyIndex(1), of the treeview object b. expandall: Expands all the nodes of the treeview object c. collapse: Collapses the node, specified arrKeyIndex(1), of the treeview object by variable
d. select: Selects the node, specified by variable arrKeyIndex(1), of the treeview object e. activate: Activates the node, specified arrKeyIndex(1), of the treeview object f. selectcolumn: Clicks the column, specified arrKeyIndex(1), of the treeview object by by variable variable
Open2Test.org
Page 12
i. activate: Activates the parent object specified by the variable parent j. maximize: Maximizes the parent object specified by the variable parent k. minimize: Minimizes the parent object specified by the variable parent l. restore: Restores the parent object specified by the variable parent If the value of arrObj(0) is not among the above listed then the function will check for arrObj, which holds the value in the third column. If the value of arrObj(0) is: i) sqlexecute: Creates DB object dbConn Executes the query using the execute method of DB object by passing strSQL variable as an argument Closes the DB object ii) sqlvaluecapture: Calls the function argument arrObj(1) Func_gfQuery() by passing the the
Stores the value returned by the function in variable in the fourth column of the data table iii) sqlcheckpoint: Sets the current row in the action sheet to 1 Sets the TO property of the connection string Changes the DB Objects source(SQL) statement Executes the DB checkpoint iv) sqlmultiplecapture: Sets the current row in the action sheet to 1 Sets the TO property of the connection string Changes the DB Objects source(SQL) statement Executes the DB output checkpoint Returns a value from the function stored variables specified in the output checkpoint in
the
Open2Test.org
Page 13
4.2.
Store Function
Name of the function: Func_Store () Description: This function is used particular object into a variable. Parameters: a) Object This is the object on which the specified operation needs to be performed. b) arrKeyIndex This parameter holds the value in the third column of the global sheet of QTP datatable. Assumptions: None Variables: a) TSplit This variable is used to store the elements after the property name stored in arrKeyIndex(0) is split with _ as the delimiter. It is used for storing values of TOProperties. b) Propname This variable is used to store the first element of variable TSplit (i.e TSplit(0)) c) strPropName - This variable is used to store the name of the Property. d) VarName This variable is to store the name of the variable in which the value of the specified property is to be stored. e) strParam4 This variable is used to store the contents present in the fifth column of the global data sheet. Functionality: Based on the values in strPropName the function performs different actions. If the value is: i) time: The current date and time is stored into the variable name specified in the fourth column of the global data sheet (VarName). exist: The exist property of the object is stored in the variable name specified in the fourth column of the global data sheet (VarName). disabled: enabled RO property of the object is captured and converted to the Boolean data type. The negation of this value is then stored in the variable name specified in the fourth column of the global data sheet (VarName). itemcount: items count RO property of the object is stored in the variable name specified in the fourth column of the global data sheet (VarName). columncount: Columncount property of the object is stored in the variable name specified in the fourth column of the global data sheet (VarName). rowcount: Rowcount property of the object is stored in the variable name specified in the fourth column of the global data sheet (VarName). content: content RO property of the object is stored in the variable name specified in the fourth column of the global data sheet (VarName). getcelldata: The return value from GetCellData method, with the row number stored in arrKeyIndex(2) and the column number to store any property of a
ii)
iii)
iv)
v)
vi)
vii)
viii)
Open2Test.org
Page 14
x)
xi)
xii)
If the value in strPropName does not have any of the values listed above then strPropName ROProperty of the object is stored in the variable name specified in the fourth column of the global data sheet (VarName).
4.3.
Check Function
Name of the function: Func_Check() Description: This function is used for all the checking operations to be performed on the AUT. Parameters: a) Object This parameter is the object on which the specified operation needs to be performed. b) arrObj This parameter holds the type of object and the object name on which the check operation has to be performed. c) arrKeyValue This parameter holds the check or checks that need to be performed on the object. d) arrKeyIndex This parameter includes details of the fourth column such as the property that needs to be checked and the input value provided. e) intRowCount This parameter holds the count of the current row in the data table. Assumptions: Context is set on the current object where the action has to be performed. Variables: a) strChkParameter This variable is used to store the mode of checking. It can have either exactchk or regexpchk as the value and by default it is set to exactchk. b) ActualValue Stores the property value retrieved from the AUT c) ExpectedValue Stores the expected value to be returned from the AUT d) strStatus Internal variable used for reporting
Open2Test.org
Page 15
tablesearch: The function Func_TableSearch is called with the variable object passed as a parameter. itemcount: The value of the items count property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and an appropriate report is generated. ExpectedValue is the integer conversion of arrKeyValue(1). columncount: The value of the ColumnCount property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and an appropriate report is generated. ExpectedValue is the integer conversion of arrKeyValue(1). rowcount: The value of the RowCount property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and an appropriate report is generated. ExpectedValue is the integer conversion of arrKeyValue(1). text: The value of the text property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and an appropriate report is generated. ExpectedValue is the value of arrKeyValue(1). selection: The value of the selection property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and an appropriate report is generated. ExpectedValue is the value of arrKeyValue(1). exist: The value of the exist property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and am appropriate report is generated. ExpectedValue is the boolean conversion of the true or false value of arrKeyValue(1). checked: The value of the checked property of the object is stored in ActualValue, which is then evaluated to be equal with ExpectedValue and an appropriate report is generated. ExpectedValue is the UpperCase value of arrKeyValue(1). tabexist: The value specified in arrKeyValue(1) is searched in the entire item range of the Tab object and an appropriate report is generated. rowsearch: The text specified in arrKeyValue(1) is searched in the table under the column name specified in
iii)
iv)
v)
vi)
vii)
viii)
ix)
x)
Open2Test.org
Page 16
itemexist: The value specified in arrKeyValue(1) is searched in the entire item range of the object and an appropriate report is generated.
Open2Test.org
Page 17
5.
5.1.
Open2Test.org
Page 18
portal: Sets the curParent object (as got from above) as curParent.SAPPortal(arrChild(1)). iview: Sets the curParent object (as got from above) as curParent.SAPiView(arrChild(1)).
After the above two select case statements, the value of curParent that is obtained is stored in the parent and can be used in the next function func_ObjectSet().
5.2.
Open2Test.org
Page 19
ix)
x)
grid: Sets the object with class SAPGuiGrid and name curObjClassName under the parent object obtained from the func_Context() function. menu: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiMenubar and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPMenu and name curObjClassName under the parent object obtained from the func_Context() function. apogrid: Sets the object with class SAPGuiAPOGrid curObjClassName under the parent object obtained func_Context() function toolbar: Sets the object with class SAPGuiToolbar curObjClassName under the parent object obtained func_Context() function and name from the and name from the
xi)
xii)
xiii)
xiv)
button: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiButton and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPButton and name curObjClassName under the parent object obtained from the func_Context() function. treeview: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiTree and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPTreeView and name curObjClassName under the parent object obtained from the func_Context() function. textbox: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiEdit and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPEdit and name curObjClassName under the parent object obtained from the func_Context() function. editor: Sets the object with class SAPGuiTextArea and name curObjClassName under the parent object obtained from the func_Context() function checkbox: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiCheckBox and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPCheckBox and name curObjClassName under the parent object obtained from the func_Context() function.
xv)
xvi)
xvii)
xviii)
Open2Test.org
Page 20
xx)
xxi)
xxii)
statusbar: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiStatusBar and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPStatusBar and name curObjClassName under the parent object obtained from the func_Context() function. tabstrip: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiTabStrip and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPTabStrip and name curObjClassName under the parent object obtained from the func_Context() function. calendar: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiCalendar and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPCalendar and name curObjClassName under the parent object obtained from the func_Context() function. codebox: If the string gui is present in the variable parChild or the variable parChild is equal to window then the function sets the object with class SAPGuiOKCode and name curObjClassName under the parent object obtained from the func_Context() function. Otherwise it sets the object with class SAPOKCode and name curObjClassName under the parent object obtained from the func_Context() function. element: Sets the object with class SAPGuiElement curObjClassName under the parent object obtained func_Context() function and name from the
xxiii)
xxiv)
xxv)
xxvi)
xxvii)
frame: Sets the object with class SAPFrame and name curObjClassName under the parent object obtained from the func_Context() function list: Sets the object with class SAPList and name curObjClassName under the parent object obtained from the func_Context() function navigationbar: Sets the object with class SAPNavigationBar and name curObjClassName under the parent object obtained from the func_Context() function dropdownmenu: Sets the object with class SAPDropDownMenu and name curObjClassName under the parent object obtained from the func_Context() function
xxviii)
xxix)
xxx)
Open2Test.org
Page 21
6.
6.1.
xxxi)
xxxii)
Fail:
Open2Test.org
Page 22
6.2.
Error-handling Function:
Name of the function: Func_Error () Description: This function is used to capture errors generated at runtime. Parameters: NA Assumptions: NA Variables: a) strError This variable is used to store the value present in the fifth column of the current row in the data sheet. Functionality: This function checks for the Err.Number after processing each keyword line. Whenever the error number is not equal to 0, the function will generate a fail report. It also checks for the strError variable, which holds the value of the fifth column of the current row in the data table. Whenever the value is onfailureexit and the value of the variable keyword is 1, the function will exit the test.
Open2Test.org
Page 23
7.
7.1.
d) intLen This variable is used to store the length of the array "arrSplit". e) ReturnVal - This variable is used to store the return value. Functionality: Based on the values in strCriteria, different actions. If the value is: i) strsearch: 1. Searches for the sub string (strSubString) in the main string (strMainString) 2. Stores the position of the substring in the return value variable (ReturnVal) ii) strconcat: 1. Concatenates the main string (strMainString) and the sub string (strSubString) 2. Stores the concatenated string in the return value variable (ReturnVal) iii) strreplace: 1. Searches for the sub string (strSubString) in the main string (strMainString) and replaces it with strString (arrSplit(2)) 2. Stores the replaced main string in the return value variable (ReturnVal) After the ReturnVal variable is updated, the value in the ReturnVal variable is stored in the variable specified in the fourth column of the data table. the function performs
Open2Test.org
Page 24
7.2.
7.3.
Open2Test.org
Page 25
7.4.
Open2Test.org
Page 26
8.
8.1.
d) inttotalrow Stores the count of the number of rows in the table e) strfind Stores the split value of the array strdatatable after splitting with delimiter : f) strColPlusValue Stores the split value of the array strfind(1) after splitting with delimiter :: g) intfor Stores the upper bound of the array strColPlusValue h) strCol1 Stores the value of StrSplitColVal(0) when the counter value of inti is set to 0 i) strCol2 Stores the value of StrSplitColVal(0) when the counter value of inti is set to 1 j) strCol3 Stores the value of StrSplitColVal(0) when the counter value of inti is set to 2 k) strVal1 strVal2 strVal3 Stores the StrSplitColVal(0) retrieved from the GetValue function value of
l) intFlag1 intFlag2 intFlag3 Flag used for checking the table contents of a particular cell m) Rownum Stores the status of the search performed in the table
Open2Test.org
Page 27
Open2Test.org
Page 28
9.
9.1.
Common Functions
Function for Retrieving Variables:
Name of the function: GetValue () Description: This function is used to retrieve the value from any variable. Parameters: a) strCellData This variable holds the type of the object and the object name on which an action should be performed or checked. Assumptions: NA Variables: a) arrSplitCheckData This variable is used to store the row number in the table where the text is present. b) strParamName This variable is used to store the flag to check if text is found or not. Functionality: This function searches for # in the variable strCellData. If # is present then the environment value in the variable is returned by the function. If # is not present then the variable strCellData is split with the delimiter _ and is stored in the array arrSplitCheckData. Based on the values in the variable arrSplitCheckData(0), the function performs different actions. If the value is: i) ii) iii) p: Returns the parameter value of the arrSplitCheckData(0) returned by the function env: Retrieves the environment value in arrSplitCheckData(0) returned by the function variable the in
variable
dt: Retrieves the value from the cell in the action 1 sheet with the column name, as in the variable arrSplitCheckData(0) and row, and in the variable intDataCounter
9.2.
Open2Test.org
Page 29
9.3.
ii)
iii)
Open2Test.org
Page 30
9.4.
Open2Test.org
Page 31
9.5.
iv)
v)
cstr: It will convert the datatype of the value in strObject1 into the string datatype and store the converted value in arrConvert(1). ascii: It will convert the value in strObject1 into ASCII value and store the converted value in arrConvert(1). trim': It will remove the extra spaces in the value in the variable strObject1. len: It will return the length of the value in the variable strObject1 and store the returned length in the variable arrConvert(1).
Open2Test.org
Page 32
9.6.
9.7.
Open2Test.org
Page 33
iv)
9.8.
d) Foldername This variable is used to store the folder name. e) oFSO This variable is used to store the created object. f) arrCellData This variable is used to store the details of the operation to be performed g) oFolder - This variable is used to store the details of the object created. Functionality: The value in the variable pCellData is split with the delimiter ; and is stored in the array arrCellData. Based on the values in the arrCellData[0] perform different actions. If the value is: i) create: If the folder with the name arrCelldata[1] is present then a report is generated stating that the folder already exists. If the folder is not present then a new folder with the name in arrCellData[1] is created. ii) delete: If the folder with the name arrCelldata[1] is not present then a report is generated stating that the folder is not present. iii) If the folder is present then the folder is deleted. the function will
Open2Test.org
Page 34
9.9.
Open2Test.org
Page 35
9.10.
Open2Test.org
Page 36
9.11.
Open2Test.org
Page 37
10.
10.1.
Reusable Functions
Function for Calling Reusable Actions
Name of the function: Func_CallAction () Description: This function is used to call a reusable action. Parameters: a) strData This holds the name of the reusable action. b) strInfo This holds the parameters for the reusable action. Assumptions: NA Variables: a) arrParam This variable is used to store the parameters to be passed to the reusable action. b) strActionName This variable is used to store the reusable action name. Functionality: This function checks for the value in the variable strInfo. If the value is Null then the function will call the RunAction method by passing the variable actionName and value oneIteration as arguments (without passing parameters). If the value is not Null then the function will split the value in the variable strInfo with the delimiter : and store it in array paramSplit. Based on the number of items in the array paramSplit, the function performs different actions. For example, if the number of items in paramSplit is 4, then 4 parameters are passed while calling the RunAction method.
Open2Test.org
Page 38
11.
11.1.
Open2Test.org
Page 39
11.2.
Loop Function
Name of the function: Func_loop () Description: This function is used to repeat a set of statements for a specified number of times. Parameters: a) variable - This holds the query variable that has to be converted. b) strconverttype This holds the data type into which the variable is to be converted. Assumptions: If the number of times to be looped is not specified, by default this number is taken as the number of active rows in the Action1 sheet of the data table. Variables: a) arrloopData This variable is used to store the start row and end row values. b) intcntr This variable is used to store the loop count. c) Counter - This variable is used to store the count value. d) endRow1 This variable stores the end row for looping. e) loopRowCount This variable stores the current loop count. f) intDataCounter - This variable stores the current data counter. Functionality: arrloopData is stored with the values after splitting the value in the third column of the data table with ; as the delimiter. The variable intcntr is assigned with the value in the fourth column in the data table. The value in the variable intcntr is converted into an integer and stored in the variable counter. The value in the variable intcntr is stored into the variable counter. This function recursively calls the Keyword_Web function (Main function) n times. Here n is the value present in the variable counter.
Open2Test.org
Page 40
12.
12.1.
Debug Functions
Function for Debugging:
Name of the function: DebugFunc () Description: script. Parameters: a) StartLineNumber - This holds the start line of the execution. b) EndLinenumber This holds the end line of the execution. c) PrintOption This holds the option to provide the QTP print dialog with the environment variables. d) LogFile This holds the option to log variables in a test file in the desktop. all the environment This function is used while debugging the keyword
Assumptions: The environment variables are not stored in a XML file and then loaded when debugging because the QTP script might have an existing XML file associated with it. Variables: a) strText This variable is used to store the contents of the log file. b) ostrFile This variable is used to store the file object. c) oFSO This variable is used to store the file system object. d) strDesktop - This variable stores the path of the desktop. e) oQtApp - This Model(AOM). variable stores the QTP Automation Object
f) oWshShell This variable stores the windows shell object. g) strContents This variable stores the contents of the log file. h) arrSplit2 This variable stores the array. i) VarName This array stores the split contents of each line in the log file. j) strVarFullName This array stores the value of each item in the array VarName. k) strVariableName This variable stores the environment variable name. l) strVariableVal This array stores the split contents of all the environment variable values in the log file. m) strVariableValue This variable stores the environment variable values. n) strFileName This variable stores the file name. o) EnvSplit This array stores the value of the environment variable mentioned in the test script data sheet. p) VariableName - This variable stores the variable name. Functionality:
Open2Test.org
Page 41
COPYRIGHT This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
Open2Test.org
Page 42