Now you'll go into Compose Test to set the JSTs to accept and pass parameters. You'll be working with seven parameters that you'll pass to the acceptance test at runtime:
$0 Name
(for the Other field in the name database record)
$1 Address 1
$2 Address 2
$3 Phone
$4 Email
$5 Other$6 Test database filename
The argument numbers you specify in the Edit Node dialog for a particular node represent the positions of the arguments that node will inherit from its parent node. These numbers do not reflect the position numbers used by the individual scripts. Each script takes whatever arguments you pass to it and numbers them sequentially within its own args[]
array, starting at zero.
Because this exercise uses parameters that are passed from one node to the other in the same order, it's hard to see what this would mean, except in the case of OpenFile. The OpenFile script uses the last parameter passed to Acceptance.jst
at runtime--args[6]
. When you specify the argument number in the Test Composer, you refer to argument #6. But the OpenFile script references args[0]
in the actual code, because it takes whatever parameters you pass it (whether it's args[0]
, args[3]
, or args[6]
) and renumbers them starting at args[0]
.
This keeps your script independent of the JST's implementation. You don't have to change a script depending on how you want to get nodes from the parent. All the Edit Node dialog needs is information on which arguments you want it to get from the parent, and it will do the rest.
To edit the OpenFile node pass parameters to the script:
Acceptance.jst
.Acceptance.jst
in the Tutorial
directory, then click Open.
OpenFile
node and click the Edit button.6.
0
.
$6 = Database filename
.
You have now set up this node of the test so that it takes the seventh argument passed to Acceptance.jst
and passes it to its own script. The script, in turn, refers to the single passed parameter as args[0]
.
Now you need to edit the AddRecord node to prepare it to pass the correct parameters to EnterFieldData.
AddRecord.jst
node and click the Edit button.0.
1
through 5
.0
through 5
.
$0 Name
$1 Address 1
$2 Address 2
$3 Phone
$4 Email
$5 Other
Edit Node for EnterFieldData
, after parameters added
Acceptance.jst
.
JavaStar informs you that Acceptance.jst
exists and asks you for confirmation to overwrite the file.
Acceptance.jst
open, open AddRecord.jst
.AddRecord.jst
node to select it. Click Open.
EnterFieldData
node and click the Edit button.0
through 5
, one for each of the text fields.
Because you have the Acceptance.jst
open already, it is easiest to define parameters for VerifySearch.jst
next.
AddRecord.jst
, click the Back button to navigate back to Acceptance.jst
.VerifySearch
node and edit.
Now you need to edit the nodes within VerifySearch.jst
. You can start with DefineSearch.
VerifySearch.jst
.VerifySearch.jst
.
DefineSearch
node. Click the Edit button.
2
.args[2]
) you pass to VerifySearch.jst
.
Value to search for
.VerifySearch.jst
, click on GetSearchResults
node.GetSearchResults
.GetSearchResults
node. Click the Edit button.
0
.VerifySearch.jst
.
Name to select
.VerifyRecord
node.The acceptance test is now set to take six parameters at the command line and pass these down to the three scripts you edited.
Send feedback to
JavaStar-feedback@suntest.com
Copyright © 1998
Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303.
All rights reserved.