Step documentation for Variable

Store a value in a variable

Fetch the value of a column in the result and store it in a variable. The result should only contain one record. Variables can be used in data tables using the name prefixed with XTestVariabes.

Sentences

Type Language Sentence
Given en ^I store the contents of the field ([a-zA-Z0-9_@$#]+) into variable ([a-zA-Z0-9_@$#]+)$

Arguments

Parameter Datatype Description
fieldName String Name of the field that holds the value to store
variableName String Name of the variable used to store the value

Examples

Given I execute the following query on source:
   """
    SELECT TOP 1 CUST_ID FROM CUST_HUB ORDER BY CUST_ID 
   """ 
  And I store the contents of the field Cust_ID into variable CustomerID
  And I insert the following data in demo table CUST_SAT:
    | Id                         | Description |
    | XTestVariables.CustomerID  | 'FirstRow'  |