Application Development


Appendix D . QA Partner Interface

You can call Prolifics functions from within QA Partner®. QA Partner, part of the QualityWorks software testing program manufactured by Segue Software Incorporated, can be used to automate functional and regression testing in client/server applications.

With the interface, you can get and set property values for widgets and screens using QA Partner methods. The interface also includes methods to get and set information about grid widgets and their members. All the Prolifics constants that are available in JPL are also available in this interface.

The following table lists the basic methods available in the interface, their associated Prolifics C functions (if available), and a description of each method. If the method has a corresponding Prolifics function, the parameters in the method will be identical to the parameters in the function, except for the Prolifics object identifier. Since the syntax used to call methods in QA Partner contains the name of the widget and/or screen, it is not necessary to specify the Prolifics object identifier as one of the method's parameters. For example, the method specification for finding the current row in a grid is as follows:

rowNumber = screenName.gridName.get_current_row()

QA Partner method Associated Prolifics function Description

get_cell_text

Returns the contents of a grid cell.

get_column_count

Returns the number of columns in a grid frame.

get_column_name

Returns the name of a grid column.

get_current_column

Returns the name of the current column.

get_current_row

Returns the number of the current row.

get_onscreen_row_count

Returns the number of onscreen rows.

get_row_text

Returns the contents of a grid row.

get_total_row_count

Returns the number of populated occurrences.

get_sm_base

Returns the value of the SMBASE variable.

is_cell_empty

Returns whether the cell is empty.

prop_error

sm_prop_error

Returns the error from the last property function call.

prop_get*

sm_prop_get*

Returns the value of the specified property.

prop_set*

sm_prop_set

Sets the value of the specified property.

set_cell_text

Sets the contents of a cell.

set_current_cell

Sets the current cell.

set_current_row

Sets the current row.

The following section lists the method, the method description, and its type and number of parameters.

get_cell_text
Returns the contents of a grid cell.
string = get_cell_text (integer iRow, integer iCol) 

get_column_count
Returns the number of columns in a grid frame.
number = get_column_count ()

get_column_name
Returns the name of a grid column.
string = get_column_name (integer iCol)

get_current_column
Returns the name of the current column.
string = get_current_column ()

get_current_row
Returns the number of the current row.
number = get_column_count ()

get_onscreen_row_count
Returns the number of onscreen rows.
number = get_onscreen_row_count ()

get_row_text
Returns the contents of a grid row.
string = get_row_text (integer iRow) 

get_total_row_count
Returns the number of populated occurrences.
number = get_total_row_count ()

get_sm_base
Returns the value of the SMBASE variable.
string = get_sm_base ()

is_cell_empty
Returns whether the cell is empty.
boolean = is_cell_empty (integer iRow, integer iCol)

prop_error
Returns the error from the last property function call.
string = prop_error ()

prop_get*
Returns the value of the specified property.
number = prop_get_int (integer iProp)
string = prop_get_str (integer iProp)
number = prop_get_dbl (integer iProp)
number = prop_get_m_int (integer iProp, integer iPropItem)
string = prop_get_m_str (integer iProp, integer iPropItem)
number = prop_get_m_dbl (integer iProp, integer iPropItem)
number = prop_get_x_int (integer iArrayItem, integer iProp)
string = prop_get_x_str (integer iArrayItem, integer iProp)
number = prop_get_x_dbl (integer iArrayItem, integer iProp) 

prop_set*
Sets the value of the specified property.
error = prop_set_int (integer iProp, integer iValue)
error = prop_set_str (integer iProp, string sValue)
error = prop_set_dbl (integer iProp, real rValue)
error = prop_set_m_int (integer iProp, integer iPropItem,
integer iValue)
error = prop_set_m_str (integer iProp, integer iPropItem, 
string sValue)
error = prop_set_m_dbl (integer iProp, integer iPropItem, 
real rValue)
error = prop_set_x_int (integer iArrayItem, integer iProp, 
interger iValue)
error = prop_set_x_str (integer iArrayItem, integer iProp, 
string sValue)
error = prop_set_x_dbl (integer iArrayItem, integer iProp, 
real rValue)

set_cell_text
Sets the contents of a cell.
error = set_cell_text (integer iRow, integer iCol, string 
sValue)

set_current_cell
Sets the current cell in a grid frame.
error = set_current_cell (integer iRow, integer iCol)

set_current_row
Sets the current row in a grid frame.
error = set_current_row (integer iRow)

The following methods are wrappers to the basic methods and can also be called in the interface:

QA Partner Method Description

GetCell

Returns the contents of a grid cell.

GetCellTrim

Returns the contents of a grid cell and trims any trailing blanks.

GetColumnNames

Returns all the column names in a grid frame.

GetColumnNamesTrim

Returns all the column names in a grid frame and trims any trailing blanks from each name.

GetContents

Returns the number of rows and columns in a grid frame.

GetNumColumns

Returns the number of columns in a grid frame.

GetNumRows

Returns the number of populated occurrences in a widget.

GetRow

Returns the contents of a grid row.

GetRowTrim

Returns the contents of a grid row and trims any trailing blanks.

PrintContents

Prints the row number and the contents of each row in an array or grid frame.

PrintRow

Prints the contents of each row.

VerifyCell

Compares the contents of a grid cell with the specified value.

VerifyCellTrim

Compares the contents of a grid cell, trimmed of any trailing blanks, with the specified value.

VerifyColumnNames

Compares the column names of a grid frame with the specified values.

VerifyColumnNames Trim

Compares the column names of a grid frame, trimmed of any trailing blanks, with the specified values.

VerifyContents

Compares the contents of each cell in a grid frame with the specified values.

VerifyCurrentCell

Compares the content of a specified cell with the specified values.

VerifyNumColumns

Compares the number of columns with the specified value.

VerifyNumRows

Compares the number of rows with the specified value.

VerifyRowTrim

Compares the contents of a grid row, trimmed of any trailing blanks, with the specified value.


Example

Samples of the interface can be found in SMBASE/samples/qapartner. The following section is taken from the vbiz.t file.

[+] testcase MovieSearchByName() appstate CustLogin
[ ] Window wVl = VideoSearch.VidList
[ ]
	[ ] // Make sure the Database.Use in Where property 
[ ] // is set to YES and the Database.
[ ] // Use in Where.Operator property is set to like%
[ ] Verify(VideoSearch.Title.prop_get_int(PR_USE_IN_WHERE),
PV_YES, "Use in Where property")
[ ] Verify(VideoSearch.Title.prop_get_int(PR_WHERE_OPERATOR),
PV_WHERE_LIKE_R, "Where Operator property")
[ ]
	[ ] // search for movies with a first word of "All"
[ ] VideoSearch.Title.SetText("All")
[ ] VideoSearch.Search.Click()
[ ]
	[ ] // Make sure only 4 rows were retrieved.  If there's 
[ ] // ever more we want the test to fail.
[ ] wVl.VerifyNumRows(4)
[ ]
	[ ] // The following assertion is intended to be 
[ ] // VerifyCellTrim rather than VerifyRowTrim.
[ ] wVl.VerifyCellTrim(1, 1, "3")
[ ] wVl.VerifyCellTrim(1, 2, "All of Me")
[ ] wVl.VerifyCellTrim(1, 3, "Carl Reiner")
[ ] wVl.VerifyCellTrim(1, 4, "COM")
[ ] wVl.VerifyCellTrim(1, 5, "PG")
[ ]