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.
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.
In the Name field, type
My expressions
, then click Create.- 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.
Optional: In the third column of the TEST CASE line, provide a useful description, such as
string ops
.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:
With your test module displayed in the TestArchitect editor, click Execute on the toolbar.
The Execute Test dialog box appears.
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.
The results in both cases are identical: