Define API test properties or user/system variables
Relevant for: API testing only
This topic describes how to define API test properties or user/system variables.
Define test parameters
This step applies if you want to define custom parameters that can be used by all steps in the test, with the ability to assign data from a data source.
-
Click the Start or End of the test flow. In the Properties pane, open the Test Input Parameters view .
-
Click the Add button to define a new input or output parameter.
-
In the Edit Input/Output Property/Parameter Dialog Box (API Testing), specify a parameter name and data type. All types that were defined in any reference file, are available.
-
Click in the Default Value column and specify a value.
Define user variables
You can create user variables and set their values. You can define multiple profiles for the variable values. You select a profile to be active before the test run.
-
Click the Start or End of the test flow. In the Properties pane, open the Test Variables tab .
-
Click the Add User Variable button to define a new user variable.
-
Give the variable a description and a default value.
Set user variable values
You can set values for variables in one of the following ways:
-
In the Properties pane's Test Variables view, click in the Profile column and manually enter values.
-
Open the Toolbox pane and drag the Set Test Variable activity from the Miscellaneous category into the Test Flow (or loop). In the Properties pane, define the variable key and value. To obtain values, click the Link to a Data Source button in the row. In the Select Link Source Dialog Box (API Testing), select the Test Variables option. Select a name and value for the Variable key and Variable value.
-
Open the Properties pane's Events view for the step or define a Custom Code activity. Edit the event handler code and assign a value using the TestProfile object. The following example sets the value of the Region user variable to NE.
activity.Context.TestProfile.SetVariableValue("Region", "NE");
Repeat this step for each variable for which you want to set values.
Define user variable profiles
This step applies only if you created user variables as described in the above steps.
-
Define one or more user variables as described above.
-
Click the Add New Profile button .
-
In the New Test Profile Dialog Box, specify a name and indicate the profile (if any) from which to copy the properties. If you do not copy the properties from an existing profile, OpenText Functional Testing copies the user variables from the active profile without its values.
-
To rename or delete a profile, click the Manage Profiles button . In the Manage Profiles dialog box, click Remove or Rename.
-
Click the Compare button to display the profiles side-by-side.
-
Only the active profile is accessed during the test run. To make a profile active, select it from the Active Profile list.
Set OS variable values for the test - optional
This step lets you set global operating system variables that will apply to all steps in the current test run.
-
From the Toolbox pane and drag the Set OS Environment Variable activity from the System category into the Test Flow or another custom loop.
-
In the Properties pane's Input/Checkpoints tab, define the variable key and value or click the Link to Source button to specify a data source.
Tip: To view a list of the test variables, click the Start or End of the test flow. In the Properties pane, open the Test Variables tab . The System variables are listed in the lower pane.