Working with mixed types

Combine numeric and string operations in single expressions, operating on both numeric and text values.

  1. In the My expressions test module you created previously, create a new test case:

    1. Place your cell pointer on a line somewhere below the existing set of action lines (but before the FINAL section, if any).

    2. Click Create New Test Case on the toolbar.

      A test case line similar to the following is inserted.

    3. In the second column of the new line, assign the test case an ID of TC 03(if not already set to that value).

    4. Press Tab to advance to the next column, and provide a description for your test case, such as mixing it up.

  2. Add a report action with a concatenation expression combining text and numeric operands:

    
                text
    report      # "The sales tax in New York is " & 7 & " per cent."
    
  3. Add another report action that combines both string and numeric operations, on both types of operand:

    
                text
    report      # "So the sales tax on a $25000 Grand Am sold in New York is " & (7/100) * 25000 & " dollars."
    

    Your test case should now resemble this:

  4. Execute Test Case 03 of your test.

    With your test displayed in the editor, do the following:

    1. Click Execute on the toolbar.

      The Execute Test dialog box appears.

    2. In the Test Modules panel, expand the tree.

    3. Ensure that only the check box for test caseTC 03is selected.

    4. Click Execute.

    The status bar (at the bottom left of the TestArchitect window) indicates the stages of the test as it progresses.

In the first report, the only numeric operand, the constant 7, has been converted to a string as a result of the concatenation operation. The expression of the second report adds numeric operations, mixing them with concatenation. Note that the numeric operations are performed first, having higher precedence than concatenation; once evaluated, the numeric result is again converted to string for the concatenation.


Copyright © 2023 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(800) 322-0333