Using string expressions

How to use concatenation to manipulate text in action arguments.

Before proceeding: Ensure that you are logged in to the SampleRepository. In the TestArchitect explorer tree, expand the Car Rental project.

  1. In the TestArchitect explorer tree, select any item within the current project, then click Create new test module in the toolbar.

    The New Test Module dialog box appears.

  2. In the Name field, type My expressions, then click Create.

  3. Notes: 
    The new test module appears in the editor with a default template containing suggested basic components for a well-designed test. For this lesson, you only need the TEST CASE section.

    In the editor, delete all content except for the TEST CASE line. Optionally, you can also delete any blank lines above the TEST CASE line.

    You are now ready to begin writing your action lines.

  4. Optional: In the third column of the TEST CASE line, provide a useful description, such as string ops.

  5. Enter the following action lines:

    
                text
    report      Pickup city: Dallas, Texas, USA
    report      # "Pickup city: " & "Dallas" & ", " & "Texas" & ", " & "USA"                   
    

    Your test case should now resemble this:

  6. With your test module displayed in the TestArchitect editor, click Execute on the toolbar.

    The Execute Test dialog box appears.

  7. Click Execute.

    The status bar (at the bottom left of the TestArchitect window) indicates the stages of the test as it progresses. Upon test completion the newly generated results page is displayed.

The argument of the first report action line (row 15) is treated as a literal string, requiring no further evaluation. By contrast, the second report action line begins with a # symbol, and so is treated as an expression. It uses the concatenation operator (&) to merge several string constants.

Notes: 
Note that, within an expression, string constants must be enclosed in quotation marks. An argument cell containing only a simple text string, as in row 15, needs no quotation marks.

The results in both cases are identical:


Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400