Using Buffers: a How-To Guide

What exactly is a buffer? Tosca uses the term Buffer to refer to values that can be temporarily saved in Tosca Commanderâ„¢ and then used again. These values can be either static or dynamic.

There are three different ways to buffer values in Tosca:

  • The values of controls can be read or verified and written into the Settings dialog as a buffer. The ActionMode Buffer is used for this purpose. For more information, click here.

  • Test data management uses its own syntax to buffer values in a database or to use values from the database. You can find more about this here and in the article "Test Data Management: an Example".

  • Values are buffered in a test configuration parameter. There is a specific syntax for using values stored in the test configuration parameter. For more, see here.

This article will give you a deeper insight into the first of these methods, the buffer.

Where can I find the buffers?

Values temporarily saved as buffers can be found in the Settings dialog under Settings->Engine.

Buffer in the Settings dialog

A buffer has two components, the buffer name and the buffer value. This brings us to our next point.

How do I buffer a value?

To buffer a value from a test object, you'll need to do two things:

  1. A Buffer name must be specified as a value of the control to be steered.

  2. Buffer is selected as the ActionMode.

The value of the control taken from the test object is saved in Tosca as the value of the buffer name in the Settings dialog. You can see an example of this in chapter "ActionMode Buffer".

Can I save the state of a control?

In some situations, it is desirable to set the state of a control and to buffer the result. In this way you can, for example, verify whether the Restart button is enabled by using the value Test01=.enabled. Test01 is written into the buffer as the buffer name. The result of the verification - False - is copied as the buffer value.

Copying the control property into the buffer

Can I create a buffer name dynamically?

Yes, you can. A buffer name can be dynamically created by using dynamic expressions in the TestStepValue. The dynamic expression for the basic date is used in this example. The static string Quote Number with the current date is copied over as the buffer name, e.g. Quote Number 02.28.2013.

Buffer with a dynamic expression

What is an XBuffer?

A dynamic value is mostly embedded into a static string. The XBuffer enables the verification of this kind of dynamic value with the following syntax.

Syntax:

{XB[<BufferName>]}

The result of this verification is both the buffer value and what the verification produces. This functionality is especially practical in the context of license and contract numbers or other values produced at runtime.

In this example, a string that contains a dynamic string is analyzed. The verified value is saved to the buffer yourID.

Reading the XBuffer

How do I use a buffer value saved in the buffer?

Buffer values can be read from the buffer with the following syntax and transferred to the test object - for example, it can be written into an editbox.

Syntax:

{B[<BufferName>]}

The CALC function can also be used to perform calculations (see "CALC - More than a little Helper").

Can I make my buffer value available to other users?

No. With this method, only values for the current workspace are buffered.

Test data management uses a database to save test data. Values can be shared with others there.

Can I delete buffers?

Buffers can always be deleted manually from the Settings dialog. If you load the default objects when you create a workspace, you will find a Module there that allows you to delete the values of all buffers automatically. Other practical tools are also hidden among the buffer Modules of the default objects.

Checklist

Have I chosen the correct buffer as my solution? Options include buffer, buffer operation modules, test data management, test configuration parameters

Did I link the buffer TestCases to an ExecutionList?

Were the TestCases executed?

Are all brackets correctly placed?

Are all formulas devoid of unnecessary spaces or line breaks?