String Blocks

This toolbar enables you to manipulate Test Flow variables by concatenating (combining) strings and parsing (extracting) specific portions of strings. To add one of these operations to the Sequence, drag it from the String toolbar to the Sequence Workspace.

To create a variable, click the "Create Variable" button from the Variables toolbar and enter the desired variable name. Once you have created a variable block, it is added to the list of available variables in the Variables toolbar. To add a variable block to the Sequence inside a String block, drag it from the Variables toolbar to the Sequence Workspace.

Settings Menu: The following parameters are available in the Settings menu for this block type.

  Comments Add comments to the block.
  Save Data Save data generated by this block and display the data in the Results table.

Concatenate Block

This block in the String toolbar enables you to concatenate (combine) strings from two or more Test Flow variables into a single string.

Example 1: Concatenate two strings

In this example, two strings are concatenated to form a single string.

  1. Create variables a, b, and c in the Variables toolbar.
  2. Drag variable a from the Variables toolbar to the Sequence Workspace and assign a value of "abcdef".
  3. Drag variable b from the Variables toolbar to the Sequence Workspace and assign a value of "123456".
  4. Drag variable c from the Variables toolbar to the Sequence Workspace and then drag a Concatenate block into the value field for variable c.
  5. From within the Concatenate block, click the "+" button two times to add two fields for variables.
  6. Drag variables a and b from the Variables toolbar into the two fields in the Concatenate block.
  7. When you execute the Sequence, the two strings are concatenated into a single string ("abcdef123456") as shown below.

  

Example 2: Add a newline (\n) character between strings

This example shows how to add a newline character (ASCII 10) between two concatenated strings.

  1. Create variables a, b, and c as shown previously in Example 1 above.
  2. From within the Concatenate block, click the "+" button three times to add three fields for variables.
  3. Drag variable a from the Variables toolbar into the top field in the Concatenate block.
  4. From the String toolbar, drag the \n (newline) block into the middle field in the Concatenate block.
  5. Drag variable b from the Variables toolbar into the bottom field in the Concatenate block.
  6. When you execute the Sequence, the two strings are concatenated into a single string but separated by a newline character as shown below.

Example 3: Add a space between strings

This example shows how to add a space between two concatenated strings.

  1. Create variables a, b, and c as shown previously in Example 1 above.
  2. From within the Concatenate block, click the "+" button three times to add three fields for variables.
  3. Drag variable a from the Variables toolbar into the top field in the Concatenate block.
  4. From the String toolbar, drag the Space block into the middle field in the Concatenate block.
  5. Drag variable b from the Variables toolbar into the bottom field in the Concatenate block.
  6. When you execute the Sequence, the two strings are concatenated into a single string but separated by a space as shown below.

 

Parse Blocks

These blocks in the String toolbar enable you to parse (extract) specific portions of a Test Flow variable string. For example, you can parse characters from the left/right side of a string or characters from the middle of a string.

Parse Left

Use the Parse Left block to parse the specified number of characters starting from the left side of the string. The example below shows the three leftmost characters parsed from the string assigned to variable a. When you execute the Sequence, the resulting parsed characters ("abc") are assigned to variable b.

Parse Right

Use the Parse Right block to parse the specified number of characters starting from the right side of the string. The example below shows the four rightmost characters parsed from the string assigned to variable a. When you execute the Sequence, the resulting parsed characters ("cdef") are assigned to variable b.

Parse Middle

Use the Parse Middle block to parse the specified number of characters beginning at the specified start index location. The default start index is "1" (Option Base 1), which is the leftmost character in the string. The example below shows two characters parsed from variable a beginning with the third character from the left (Start Index 3). When you execute the Sequence, the resulting parsed characters ("cd") are assigned to variable b.

See Also

Variables Blocks