SetVariableValue Method

Relevant for: API testing only

Description

Sets the value of a selected test or environment variable.

Class

TestProfile

Syntax

this.<activity>.Context.TestProfile.SetVariableValue("<variable name>" , "<variable value>");
this.<activity>.Context.EnvironmentProfile.SetVariableValue("<variable name>" , "<variable value>");

Parameters

Parameter Description
Variable name A string for the name of the variable. You can find this value in the Test Variables tab in the Properties pane.
Variable value The value for the variable. The format differs on the expected use of the variable.

Return Type

No explicit return - the variable value is set for use in the test run.

Example

var activity = ((HP.ST.Ext.WebServicesActivities.StServiceCallActivity)(args.Activity));
activity.Report( "codeCheckPointEvent" , "code CheckPoint event" );
args.Checkpoint.Report("CheckPoint","CheckPoint","=" , HP.ST.Fwk.RunTimeFWK.CheckpointFWK.StatusEnum.Succeed );
activity.Context.EnvironmentProfile.SetVariableValue( "codeCheckpointEvent","true");