Parameter Element

Description

A test object method argument.

Important Information

This element can be used in the Record definition's RecordedCommand element or in the Replay definition's Methods and Parameters elements.

  • When recording (the RecordedCommand element):

    Each Parameter element defines an argument to be written to the test after the name of the RecordedCommand element. The arguments are written to the test in the order in which they are defined in the Control Definition XML file.

    A Parameter element may contain a single line of text content that provides a value for the argument and is evaluated and then written to the test. Alternatively, the Parameter element may contain a short section of code to be run to produce the value to be written. If the Parameter element contains code, the lang attribute must be specified, and the final value must be assigned to the return value variable, Parameter.

    You can use the following reserved words in a Parameter element:

    Sender. The object on which the event occurred.

    EventArgs. The class that contains the event data provided by the Windows Event Handler.

    Parameter. The value of the test object method argument, when produced by a section of code. If the Parameter element contains code, set the value for the test object method argument using the Parameter reserved word. Otherwise, do not use this word in the Parameter element definition.

  • When running tests (the Replay element):

    Parameter elements map the arguments in the test step that UFT is running to the parameters used in the method call defined in the MethodBody element. You must define a Parameter element for each argument in the test step. The Parameter elements must be listed in the Control Definition XML file in the same order as the respective arguments are listed in the step.

Attributes

NameTypeUseDefaultDescription
langstringoptional This attribute can be used when the Parameter element is used with the RecordedCommand element. If the element contains code, the lang attribute is mandatory and specifies the programming language. Currently, C# is supported. If the element contains a single line of text, do not specify the lang attribute.
namestringoptional This attribute can be specified when the Parameter element is used with the Methods and Parameters elements. The name by which to refer to the value in the MethodBody.
typeNMTOKENoptional This attribute can be specified when the Parameter element is used with the Methods and Parameters elements. The data type of the value as it will be used in the MethodBody.

Used By