Tosca ActionModes, Buffers, and Dynamic Expressions
Edited by Dev Kilaru, Senior Data Analyst. How we make our content
Introduction
ActionModes tell Tosca what to do with a control: write a value, read it, check it, or wait for it. Buffers let you capture a value from the application and use it later in the same test. Together they make tests dynamic. This lesson explains the main ActionModes and the buffer syntax.
Prerequisites
- TestCases and TestSteps in Tosca Commander
- A working TestCase to experiment with
Step-by-Step Guide
Step 1: Learn the two groups of ActionModes
Input and Insert write values into a control. Buffer, XBuffer, Constraint, Verify, WaitOn, and Select read from a control. Choose the mode that matches what the step should do, and set it per control.
Step 2: Verify values
Verify compares the control's actual value with the expected value you enter. Comparisons are case-sensitive and the whole string must match, and regular expressions are supported for flexible checks. See the Tosca documentation for the exact regular expression syntax in your version.
Step 3: Capture values with Buffer
Buffer stores a value from the application under a name you choose, so the test can reuse it later. Read it back with the buffer expression {B[Name]} in a later step. Buffers can be read at any point after they are set during the execution.
Step 1: Order Number ActionMode: Buffer Value: OrderNo
Step 2: Search Field ActionMode: Input Value: {B[OrderNo]}
Step 3: Status Message ActionMode: Verify Value: ShippedStep 4: Handle dynamic text with XBuffer
When only part of a string is dynamic, such as a generated ID inside a message, use XBuffer with the expression {XB[Name]} to capture that part. Verify can then check the rest of the text while the buffer holds the changing portion.
Step 5: Wait for conditions with WaitOn
WaitOn makes a step wait until a control reaches the expected state instead of using fixed delays, which makes tests faster and more reliable. Text expressions can be used as values for Input, Verify, Buffer, Constraint, and WaitOn.
FAQs
- What are buffers used for?
- They carry values captured from the application, such as a generated order number, to later steps in the same test, so you do not need to know the value in advance.
- Why is Verify case-sensitive?
- Tosca compares the full string exactly, so Shipped and shipped are different. Use a regular expression if you need a looser match.
Summary
Pick the ActionMode that matches the intent of the step, capture runtime values with Buffer and XBuffer, reuse them with {B[Name]} and {XB[Name]}, and use WaitOn instead of fixed waits. The sample steps above are illustrative; configure real ones from your own Modules.
Comments
Log in or create a free account to join the discussion.