Create a test module / test case that reports the sales tax for cars across a range
In the TestArchitect explorer tree, select any item within the Car
Rental project, then click Create new test module
The New Test Module dialog box appears.
as the name, then click
A new test module appears in the main
panel, ready for editing.
In the INITIAL section, declare the following local variables
with initial value of 0:
local variable NY sales tax 0
local variable car price 0
Since these local variables are declared in the INITIAL
section, they are accessible throughout the test module.
In the third column of the TEST CASE line, type a
description (for example, create a report).
Skip down a few rows and type the following action lines:
local variable NY sales tax 7
local variable car price 20000
report # "The New York sales tax (" & NY sales tax & "%) on a $" & car price & " car is " & (NY sales tax/100) * car price & " dollars."
The local variable action lines here assign new values to
variables NY sales tax and car price.
Tip: During an editing session, entering the # symbol in
an empty argument cell triggers an autocomplete pop-up window containing a list of variables
thought to be within scope at that position in the action lines. Use the
Up and Down arrow keys to select one, should you
need it inserted at that point. You can bring back the pop-up list at any further point in the
expression by pressing Ctrl + Space
Select these three action lines in their entirety (headers included), and press
Ctrl+C to copy them.
Move your cell pointer a few rows past the last line, and press
Ctrl+V to paste. Repeat this process so that your
test case holds a total of seven action lines.
You can delete the two new local variable lines for
NY sales tax, as that value will not be changed.
Modify the value argument of the third local
variable action for car price to
25000, then modify the next one to
Your test case should now resemble the following:
You now have three sets of local variable /
report action lines in which the value of car
price varies, but where each report action line
With your test module displayed in the TestArchitect editor, click
on the toolbar.
The Execute Test dialog box appears.
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.
Click on the Result Details subtab to view the output of the
report action lines, indicating the New York state tax amount
required for a car purchase at three different prices:
The above test case has repeating action lines (identical report
actions), which differ only by the value of a variable which increases by the same
amount each time. This situation is well suited for iteration, or