Buffer Operations

The folder TBox Automation Tools->Buffer Operations in the Standard subset contains the following Modules:

For information on how to use buffered values in your TestCases, see chapter "Text expressions".

TBox Set Buffer

Use the Module TBox Set Buffer to perform one of the following actions:

  • Create a Buffer with a particular value.

  • Verify the value of an existing Buffer.

The Module has the following ModuleAttribute:

ModuleAttribute

Description

<Buffername>

Replace <Buffername> with the name of the Buffer.

  • To save a value to the Buffer, enter the desired value into the Value column. Use ActionMode Input.

  • To verify the value of the Buffer, enter the value in question into the Value column. Use ActionMode Verify.

This example shows how to work with TBox Set Buffer.

  • The first TestStep saves the value 12345 to a Buffer named ExampleBuffer.

  • The second TestStep checks whether the value of the Buffer named ExampleBuffer is 12345.

TBox Set Buffer example

TBox Name To Buffer

This Module allows you to buffer the name of the TestCase that uses the Module.

You can buffer the name of a TestCase if you run the TestCase via ExecutionList in the Execution section. ScratchBook does not support this functionality.

The Module TBox Name To Buffer has the following ModuleAttribute:

ModuleAttribute

Description

Buffer

Name of the buffer to which you want to save the TestCase.

Use ActionMode Input.

In this example, you write the name of the TestCase TestCase 12345 to a Buffer named TC_Name.

TBox Name To Buffer example

TBox Partial Buffer

Use this Module to perform the following actions:

  • Buffer parts of a value.

  • Verify parts of a buffered value.

The Module TBox Partial Buffer has the following ModuleAttributes:

ModuleAttribute

Description

Buffer

Name of the Buffer.

Value

Value you want to buffer or verify.

Start

Character index from which you want the system to start buffering or verifying the value.

End

Character index that ends the value you want to buffer or verify.

Last

Number of characters you want to buffer or verify, starting from the last character.

If you set this value, Tosca Commander ignores the ModuleAttributes Start and End.

This example shows how to create and verify a partial Buffer.

  • The first TestStep creates the Buffer ExampleBuffer with the value Value 12345.

  • The second TestStep writes the last 5 characters of ExampleBuffer to the partial Buffer named PartialBuffer.

    Consequently, the value of PartialBuffer is 12345.

  • The third TestStep checks whether the value of PartialBuffer is 12345.

Set and verify a partial Buffer

TBox Delete Buffer

Use this Module to remove individual or all existing Buffers.

The Module TBox Delete Buffer has the following ModuleAttribute:

ModuleAttribute

Description

Buffer

Name of the Buffer that you want to delete. Use ActionMode Select.

You can delete Buffers as follows:

  • To delete all existing Buffers, leave this ModuleAttribute empty or enter the wildcard character *.

  • To delete multiple Buffers, use the wildcard character * to replace one or more characters in the Buffer name.

Note that to use the wildcard character * with buffers, you must also create a UseWildcards steering parameter and set it to True.

The TestStep in this example deletes the Buffers Buffer1 and Buffer2.

Delete two Buffers

TBox Iterate Array

Use this Module to iterate a buffered array, such as a table row or column. TBox Iterate Array outputs each array element individually. For instance, you can buffer a column containing customer names and send each name individually to the system under test. Tosca sends each array element in sequential order.

You need to use this Module in a WHILE statement. Put the TBox Iterate Array under Condition. You then put the module you want to receive the iterated output under Loop. For details on creating WHILE statements, check out Using conditional statements and loops in TestCases.

The Module TBox Iterate Array has the following ModuleAttributes:

ModuleAttribute

Description

Array to Iterate

Name of the Buffer containing an array that you want to iterate.

Target Buffer

Name of the Buffer that you want to receive the iterated output. Use ActionMode Input.

This example show how to buffer an array, iterate the buffered array, and send iterated output.

  • The TestStep Buffer all employee IDs buffers a column containing employee ID numbers into a buffer named employees.

  • The WHILE Statement creates a loop with the Module TBox Iterate Array under Condition.

  • The ModuleAttribute Array to Iterate has the value {B[employees]}, the buffer from the first TestStep.

  • The ModuleAttribute Target Buffer creates a new buffer, id. This buffer contains an individual item from employees. The first time the loop runs, id contains the first employee ID from the array. The second time, id contains the second employee ID. And so on.

  • Under Loop, the WHILE Statement then sends each employee ID via an API call.

Iterate a buffered array

TBox Array Operation

You can use this Module to run advanced operations with array elements of an existing buffer. Or you can use it to create an array from elements you manually define.

The Module TBox Array Operation has the following ModuleAttributes:

ModuleAttribute

Description

Array

Use the dynamic expression {B} to define which buffered array you want to run your operation on. Use ActionMode Select.

Content

Your use case determines what you need to do with Content:

Item

You don't need Item in every use case. For information on when and how you do, check the respective use case: 

To specify index positions, use one of the following values:

  • # <index position number>. Index positions start at 1.

  • #last to specify the last element in the array.