Utility
Functions
SystemUtil.Run:
Description:
Runs
a file or application.
Syntax:
object.Run
file, [params], [dir], [op], [mode]
Object
|
|
File
|
Required. A String value.
The name of the file you want to run.
|
Params
|
Optional. A String value.
If the specified file argument is an
executable file, use the params argument to specify any parameters to
be passed to the application.
|
Dir
|
Optional. A String value.
The default directory of the application or file.
|
Op
|
Optional. A String value. The action to be performed. If
this argument is blank ( ""), the open operation is performed.
|
Mode:
|
Optional. An Integer value.
Specifies how the application is displayed when it
opens. You can specify one of the modes in the table below.
Default = 1
|
-------------------------------------------------------------------------------------------------
Environment.Value:
Description :
You can set or retrieve the value
of environment variables using the Environment object. You can retrieve the
value of any environment variable. You can set the value of only user-defined,
environment variables.
Syntax :
Environment.ExternalFileName:
Description :
Returns the name of the loaded
external environment variable file specified in the Environment tab of the Test
Settings dialog box. If no external environment variable file is loaded,
returns an empty string.
Syntax:
Example :
The following example uses the
ExternalFileName property to check whether an environment variable file is
loaded, and if not, loads a specific file and then displays one of the values
from the file.
-------------------------------------------------------------------------------------------------
Environment.LoadFromFile filename
Description:
Loads the specified environment
variable file. The environment variable file must be an XML file using the
following syntax:
For more
information about environment variable files, refer to the QuickTest Professional User's Guide.
Syntax :
Example
-------------------------------------------------------------------------------------------------
Reporter.ReportEvent:
Description:
Syntax :
0 or micPass: Causes the status of this step
to be passed and sends the specified message to the report.
|
||
Example:
-------------------------------------------------------------------------------------------------
DataTable.Value:
Description :
DataTable default property.
Retrieves or sets the value of the cell in the specified parameter and the
current row of the run-time Data Table.
Note: This property returns the
computed value of the cell. For example, if the cell contains a formula, the
method returns True or False.
Syntax :
-------------------------------------------------------------------------------------------------
Parameter.Item (parametername):
Parameter: A
value that is defined or generated separately from the step and is retrieved
when the specific step runs.
Configuring a Parameter Value :
If you select Parameter for a value that is already
parameterized, the Parameter box displays the current parameter
definition for the value. If you select Parameter for a value that is
not yet parameterized, the Parameter box displays the default parameter
definition for the value.
Setting Test and Action Parameter Options
Test and action parameters enable you to use parameter
values that have been passed from the external application that ran (called)
your test. The Parameter options that are available depend on where you are
currently located in your test, and whether test or action parameters are
defined
When Test/action parameter is selected as the parameter type,
you can select the required parameter in the Parameter Options dialog box. You
open the Parameter Options dialog box by clicking the Parameter Options
button in any Checkpoint Properties dialog box
Defining the Settings for a Test or Action Parameter
- Test parameters or Parent action parameters. Parameter defined in the test or parent action. (If no output parameters are defined in the test or parent action, this area is disabled.) Test parameters are available only for top-level actions. They are defined in the Parameters tab of the Test Settings dialog box. Parent action parameters are available for subsequent steps and for nested actions. They are defined in the action containing the steps or in the action that calls the nested action.
- Parameter. Specifies the name of the input parameter. The read-only list of available parameters contains the names and full descriptions of the currently defined input parameters for the action. You can resize the display, as needed, and, if the list of parameters is long, you can scroll through the list.
- Output from previous action call(s). Any previous action in the same hierarchical level for which output parameters are defined. (If no output parameters are defined in previous actions, this area is disabled.)
- Action. Specifies the previous action from which you can choose an output parameter. You can choose any action in the list.
- Parameter. Specifies the name of the output parameter. The read-only list of available parameters contains the names and full descriptions of the currently defined output parameters from the previous action(s). You can resize the display, as needed, and, if the list of parameters is long, you can scroll through the list.
-------------------------------------------------------------------------------------------------
Test Object
Functions
GetROProperty:
GetROProperty method to retrieve the current
value of a test object property from a run-time object in your application.
you can retrieve the target value
of a link during the run session as follows:
link_href = Browser("Mercury
Technologies").Page("Mercury
Technologies").Link("Jobs").GetROProperty("href")
-------------------------------------------------------------------------------------------------
GetTOProperty:
Description:
Returns the value of the specified property from the test
object description.
Syntax:
object.GetTOProperty
(Property)
Argument
|
Description
|
object
|
A test object of type WinTreeView.
|
Property
|
Required. A String value.
The property whose value is retrieved from the object
description.
|
Return Value:A
Variant value.
Remarks:
GetTOProperty differs from
the GetROProperty method. GetTOProperty returns the value
from the test object's description. GetROProperty returns the current
property value of the object in the application during the test run.
-------------------------------------------------------------------------------------------------
Exist:
Description :
Syntax :
Return Value : Boolean
Example:
The following example creates a
database checkpoint and then checks that the database table object exists.
-------------------------------------------------------------------------------------------------
CheckProperty:
Description:
Checks whether the specified object property achieves the
specified value within the specified timeout.
Syntax:
object.CheckProperty
(PropertyName, PropertyValue, [TimeOut])
Argument
|
Description
|
Object
|
|
PropertyName
|
Required. A String value.
The name of the property whose value is checked. The
available properties are listed in the Identification Properties page under
the Properties section for each test object.
|
PropertyValue
|
Required. A Variant value. The expected value against
which the actual property value should be checked. You can either use a
simple value or you can use a comparison object together with the
value to perform more complex comparisons.
|
TimeOut
|
Optional. An ULong object. The time, in
milliseconds, within which QuickTest should check whether the actual
value of the property matches the specified expected value. If no value is
specified, QuickTest uses the time set in the Object Synchronization Timeout
option in the Run tab of the Test Settings dialog box.
|
Return Value
A Boolean value. Returns TRUE if the property
achieves the value, and FALSE if the timeout is reached before the property
achieves the value.
A TRUE return value reports a Passed step to the test
results; a FALSE return value reports a Failed step to the test results.
-------------------------------------------------------------------------------------------------
WaitProperty:
Description:
Waits until the specified object property achieves the
specified value or exceeds the specified timeout before continuing to the next
step.
Syntax:
object.WaitProperty
(PropertyName, PropertyValue, [TimeOut])
Argument
|
Description
|
Object
|
|
PropertyName
|
Required. A String value. The name of the property whose
value is checked.
|
PropertyValue
|
Required. A Variant value. The value to be achieved before
continuing to the next step.
|
TimeOut
|
Optional. A Long value. The time, in milliseconds, after
which QuickTest continues to the next step if the specified value is not
achieved. If no value is specified, QuickTest uses the time set in the Object
Synchronization Timeout option in the Run tab of the Test Settings dialog
box.
|
Return Value
A Boolean
value. Returns TRUE if the property achieves the value, and FALSE if
the timeout is reached before the property achieves the value. A FALSE return
value does not indicate a failed step.
-------------------------------------------------------------------------------------------------
GetContent:
Description:
Returns all of the items in the combo box list.
;’[
Syntax:
object.GetContent
Argument
|
Description
|
object
|
Return Value
A String
value. The returned string contains all of the items in the
list separated by VBScript line feed characters.
-------------------------------------------------------------------------------------------------
Select:
Description:
Selects the specified item in the list, replacing any
previously selected values.
Syntax
object.Select
Item
Argument
|
Description
|
object
|
|
Item
|
Required. A Variant value. The value to select. The value
can either be one of the items in the list or an index. To specify the index
of the item to select, use "#index". Index values begin with 0.
|
Return Value:None.
-------------------------------------------------------------------------------------------------
GetItemsCount:
Description
Returns the number of items in the combo box list.
Syntax
object.GetItemsCount
Argument
|
Description
|
object
|
Return Value : A
Long value.
-------------------------------------------------------------------------------------------------
GetItem:
Description
Returns the value of the item specified by the index.
Syntax
object.GetItem
(Item)
Argument
|
Description
|
object
|
|
Item
|
Required. A Variant value. Numeric index of the item.
Index values begin with 0.
|
Return Value:A
String value.
-------------------------------------------------------------------------------------------------
RowCount:
Description:
Returns the number of rows in the table.
Syntax:
object.RowCount
Argument
|
Description
|
object
|
Return Value: A
Long value.
-------------------------------------------------------------------------------------------------
ColumnCount:
Description:
Returns the number of columns in a (report-style) list-view
control.
Syntax:
object.ColumnCount
Argument
|
Description
|
object
|
Return Value:A
Long value.
Remarks:
Only the visible columns are counted.
-------------------------------------------------------------------------------------------------
GetCellData:
Description
Retrieves the contents of the specified cell from the table.
Syntax
object.GetCellData
(Row, Column)
Argument
|
Description
|
Object
|
|
Row
|
Required. A Variant value. The 0-based index of the row
containing the cell whose data you want to retrieve. The index value is
recorded in the format "#N" where N is the 0-based row index. When
entering the argument value manually, you can use any of the following string
or number formats: "#N", "N", or N.
|
Column
|
Required. A Variant value. The name or 0-based index of
the column containing the cell whose data you want to retrieve. The column
value is recorded in the format "#N" where N is the 0-based column
index. When entering the argument value manually, you can use any of the
following string or number formats: "ColumnName", "#N",
"N", or N.
|
Return Value:
A String value.
-------------------------------------------------------------------------------------------------
DataTable
Method
GetRowCount:
Description :
Returns the total number of rows
in the longest column in the first sheet in the run-time Data Table (global
sheet).
Syntax
Return Value : Number
Example :
The following example uses the GetRowCount
method to find the total number of rows in the longest column of the MySheet
run-time data sheet and writes it to the report.
-------------------------------------------------------------------------------------------------
SetNextRow:
Description:
Note:
You can only set a row that contains at least one value. If the current row is
the last row in the Data Table, applying this method sets the first row in the
Data Table as the new current row.
Syntax :
Example :
The following example uses the SetNextRow
method to change the active row to the next row in the run-time Data Table.
SetCurrentRow:
Description :
Syntax :`
Example
The following example uses the SetCurrentRow
method to change the active row to the second row in the global run-time Data
Table.
GetSheet:
Description :
Syntax :
Return Value : Number
Example :
The following example uses the GetSheetCount
method to find the total number of sheets in the run-time Data Table and writes
it to the report.
-------------------------------------------------------------------------------------------------
GetParameterCounts:
Description :
Syntax : DTSheet.GetParameterCount
Return Value :Number
Example
The following example uses the GetParameterCount
method to find the total number of parameters (columns) in the run-time Data
Table sheet (MySheet) and writes it to the report.
-------------------------------------------------------------------------------------------------
AddSheet:
Description :
Adds the specified sheet to the
run-time Data Table and returns the sheet so that you can directly set
properties of the new sheet in the same statement.
Syntax :
Return Value : DTSheet Object.
Example :
The following example uses the AddSheet
method to create the new sheet, "MySheet" in the run-time Data Table
and then adds a parameter to the new sheet.
-------------------------------------------------------------------------------------------------
DeleteSheet:
Description :
Syntax :
Example
The following example uses the DeleteSheet
method to delete the sheet, "MySheet" from the run-time Data Table.
-------------------------------------------------------------------------------------------------
GetSheetCount:
Description : Returns the total number of sheets in the run-time Data Table.
Syntax : DataTable.GetSheetCount
Return Value : Number
Example
The following example uses the GetSheetCount
method to find the total number of sheets in the run-time Data Table and writes
it to the report.
sheetcount =
DataTable.GetSheetCount
Reporter.ReportEvent 0,
"Sheet number", "There are " & sheetcount & "
sheets in the Data Table."
AddParameter:
Description :
Adds the specified parameter
(column) to the sheet in the run-time Data Table, sets the value of the first
row to the specified value, and returns the parameter so that you can directly
set or retrieve properties of the new parameter in the same statement.
Syntax : DTSheet.AddParameter(ParameterName, Value)
Return Value :DTParameter Object
Example
The following example uses the AddParameter
method to create the new Parameter, "Arrival" within the new sheet,
MySheet of the run-time Data Table, and sets the first cell in the column as
"New York".
Because the method also returns the newly created parameter, it is possible to
use methods or check properties of the new sheet within the same statement.
Note that
if a parameter with the name "Arrival" already exists in the sheet,
the example above will return "Arrival1" as the actual name assigned
to the new parameter.
No comments:
Post a Comment