Variables

A Variable holds a persisted value. A Variable can be entered by the user and or updated by one of the following elements:

Conceptual Overview

A Variable can be defined for the four following test definition hierarchy elements. A Variable name must be unique for an element it is assigned to.

Variable Holder types

Variables can be assigned to these four test definition elements, sometimes referred to as holder types.

  • Repository
  • Testset
  • Testcase
  • Teststep

Variable types

The variable type depends on the selected tab in the editor:

  • String Arbitrary Text
  • Password Any text. This types hides the value in the variable list view and during edits and be undisclosed on demand
  • absolute Date Enter a static date to reproduce tests. The Variable Editor provides a convenient means to enter the date and formatting for the service call.
  • relative Date Creates a date relative to the current date. On Test runs, this relative is re-evaluated.This allows you to enter a date of birth or a date of manufacturing and make sure the webservice under test will always calculate the same age.
  • Number Numbers need specific formatting. This formatting is provided for variables of type number
  • Boolean Booleans have 0 / 1 values. The variable editor allows use of true/false or yes/no as text for the boolean values.

Create a Variable

Variables can be created on two different places:

  • In the variables view, this is explained in Variables View
  • In the variables assignment view on Teststep ValueProviders and Random ValueProvider

Access Variable values

Variable placeholders are simply substituted by their current values, just like a makro. Variable values can be used in these contexts:

  • SOAP Requests
  • URLs of the SOAP Request
  • XPath expression for Assertions and ValueProviders
  • XQuery expressions for ValueProviders

Variable access syntax

  • Teststep variables: $(Teststep.<variablename>)
  • Teststep variables: $(Testcase.<variablename>)
  • Testset variables: $(Testset.<variablename>)
  • Repository variables: $(Repository.<variablename>)

VariableValueTransfer

When you want to update your variable from within a test step, you will use a VariableValueTransfer, they are the common component for ValueProviders to transfer data to a variable of type String.


Attachment placeholders

Attachment placeholders in SOAP Requests are not variables and use a special, but similar naming convention. see SOAP Attachments