Adding Parameters for Flexibility: Exercise: Adding Parameters to the VerifyNames tests


This test builds on the optional exercise from the last chapter.

Instructions

This time:

  1. Edit the scripts you wrote for VerifyNames.jst (or whatever you called your Names test) and add parameters.

  2. Modify VerifyNames.jst to support parameter passing.

  3. Incorporate VerifyNames.jst into Acceptance.jst, naming the modified JST Acceptance2.jst.

If you did not do the exercise for the last chapter, copy the following files from \tutorial\modular:

Solution

This solution uses a modified version of Acceptance.jst from this lesson and saves that as Acceptance2.jst. If you did the exercise this way, you didn't have to add all the parameter information for AddRecord and VerifySearch to the previous version of Acceptance2.jst.

Only one script needed parameters to work within the current model, and that's SelectName. This solution changes the SelectName node within VerifyNames.jst to inherit args[0] (the name field of the record) from Acceptance2.jst. You can see the solution shows the SelectName script referencing args[0] in place of "Count von Count". If you did this, you also should have removed the position reference in the select() call to make the script more versatile.

VerifyRecord is the same script already modified earlier in this chapter, so you only needed to change VerifyRecord node within VerfiyNames.jst to inherit args[0] through args[5].

Changing the VerifyNames node in Acceptance2.jst to also inherit args[0] through args[5] completes the solution. You can view these files in the \tutorial\parameters directory.




Send feedback to JavaStar-feedback@suntest.com
Copyright © 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303. All rights reserved.