Documentation › Stored Variables in the Recorder
Reuse stored variables in recorded steps
The MaxTAF Recorder can now type a value that an earlier step stored into a field later in the same recording. You store a value with Store Value, Store Text or Store Title, then right-click a field and choose Send Stored Variable. The exported MXML step types the variable, not the value you saw while recording, so the case uses whatever the variable holds when it runs. You can also place a stored variable in a step after you record it: Add variable on a typing step, or Edit value on an assert or verify step.
What it is
A Store step reads a value from the page into a named variable, for example the number Maximo gives a new work order. Later in the recording, you right-click a text field and open MaxTAF Recorder ▸ Store ▸ Send Stored Variable. The recorder types the stored value after the text already in the field, so you can carry on recording, and it records a step that refers to the variable.
You record
Store Value on the Work Order field, as WONUM
...
Type "WO-" into a field, then Send Stored Variable ▸ WONUM
The case exports (locators shortened)
<var name="WONUM" type="String">""</var>
<ui:getValue var="WONUM"> … </ui:getValue>
...
<ui:sendKeys text="WO-${WONUM}"> … </ui:sendKeys>
Text you type after the variable is added after it, and the variable stays in the step. If you send a second variable into a field that already holds one, the step keeps both.
In a step's ⋮ More options menu, Add variable (on Input steps) and Edit value (on Input, Assert and Verify Value, Text and Title steps) open a dialog with the step's text. Click where the value goes, then choose a variable from the Stored values list. The list shows the variables that Store steps above this step saved. The variable can go anywhere in the text, for example WO ${WONUM} approved, and shows as a block. Click the block to change it to another variable or to remove it. The variable is read when the case runs.
A ${NAME} is a variable only when it was put there on purpose, by Send Stored Variable or from the dialog. Text you type yourself, including $ and ${...}, is kept exactly as typed.
Why we built it
Many Maximo tests create a record and then use it. You create a work order, Maximo gives it a number, and later in the same test you search for that number, or check that a related record shows it. The number is different on each run.
A recording types the text it saw. For fixed data, such as a site or an asset, that is what you want. For a value the test itself generated, it means the replay types the number from the recording session. Hand-written MXML can read the number into a variable and reuse it, but writing it takes time and MXML knowledge. Stored variables in the recorder give you the speed of recording and the reuse of written MXML in the same case.
| Hand-written MXML | Plain recording | Recording with stored variables | |
|---|---|---|---|
| Time to create | Longer: you write each step | As long as the workflow takes | As long as the workflow takes |
| A value the test generates | Read into a variable and reused | Typed as it was when recorded | Read into a variable and reused |
| Skills needed | MXML | Using Maximo | Using Maximo, plus a right-click |
Recorded at the speed of using Maximo. Replays with the values of this run.
- You add the reuse while you record. A right-click on the field records the variable step, without opening the MXML.
- You replay with the value this run created. The step types the variable, so a search finds the record this run made, not the one from the recording session.
- You check against the value this run created. With Edit value, an Assert or Verify Value, Text or Title step can compare against a stored variable instead of a fixed value.
- You change a recorded value without editing MXML. The dialog shows the text the step uses on replay and puts variables in at the cursor.
How to get started
- Open the recorder window and start recording. Keep the recorder window open while you use Send Stored Variable: its dialog shows there.
- Store the value. Right-click the field that holds it, for example the work order number after you save, and choose MaxTAF Recorder ▸ Store ▸ Store Value (or Store Text, or Store Title). Give the variable a name, for example
WONUM. - Send it into a later field. Right-click a text field and choose MaxTAF Recorder ▸ Store ▸ Send Stored Variable.
- Choose the variable and click Send. The Send a stored variable dialog shows each variable's remembered value and its kind (Value, Text or Title), the text already in the field (kept in front), and what the step types on replay. The newest variable is selected for you; double-click a variable or press Enter to send it.
- Optional: add a variable to a recorded step. On a typing step, open ⋮ More options ▸ Add variable; on an assert or verify step, open ⋮ More options ▸ Edit value. Click where the value goes, choose it from Stored values, and click Apply.
- Export the case as usual and check the step in the MXML.
A Store step must come first. Without one, the recorder shows a message that there are no stored variables yet.
If the recorder window is closed, Send Stored Variable asks you to open it and does not type into the field.
Send Stored Variable works on text fields only.
If you change or delete part of the sent value in the field, the step records the text as typed, without the variable. Add variable can put it back.
Edit value also changes the text of Edit Content steps and comments, but these steps cannot hold a variable. A ${NAME} in them is kept as plain text.
Artefacts
| Reusing a stored value | Recorder Guide — Reusing a stored value |
| Editing a step's value | Recorder Guide — Editing a step's value |
| Store, Assert and Verify actions | Recorder Guide — Assertions and stored values |
| Related in Recorder 2.1.0 | Parameters in typed values · Export Template |