Using Variables

From STIQ

Jump to: navigation, search

There are 2 types of variables in STIQ: FitNesse and Selenium.

FitNesse Variables

  • FitNesse variable values are set by the define widget and are effectively Constants -- they can't be changed dynamically at run time.
  • They are resolved when a page using it is rendered.
  • The FitNesse wiki server walks up the page hierarchy until it finds the corresponding variable definition and substitutes that value when rendering the page.

Definition:

!define variableName {variable value here}

Use:

${variableName}

Example:

| open | ${siteRoot} | |

Selenium Variables

  • Selenium variable values are set and changed using the "store" command and "store" prefixed assertions.
  • The are resolved dynamically in the context of a single test run.
  • They must be "escaped" (with !- -! syntax) in most cases because the syntax is the same as FitNesse variable syntax and the FitNesse wiki server will attempt to resolve them otherwise.

See Stored Variables and Variable Substitution for Selenium documentation.

Examples:

| echo | !-${message}-! | |
| type | !-${lastName}-! | |

The Show command is a STIQ extension that takes a Selenium variable name as a parameter, so the name is not "escaped":

| show | lastName | |
Personal tools
Noteworthy