When you compose a JST, you create nodes that correspond to test scripts or other JST files. Then you specify the dependencies between these nodes by setting normal and exception conditions. You can set any node to restart the application or applet under test before the JST executes the node. You can change the root (starting node) from the default. You can also specify parameters to send to a node, assuming the script it represents accepts parameters.
The basic rules about JSTs are:
Most of the Test Composer functions are represented by buttons on the left side of the window (see Figure 7-3).
You can also access these functions by putting your mouse cursor in the large open test area, holding down the right-mouse button, and selecting functions from the pop-up menu that appears. If you right click over an existing node or a connecting line, the menu displays only the options that apply to the node or connecting line.
This section describes:
Test Name dialog
JavaStar shows script nodes as rectangles with squared corners and JST nodes as rectangles with rounded corners. If the name you enter ends with .jst
, JavaStar inserts a JST node into your test. If you enter a name without a .jst
extension, JavaStar inserts a script node.
A script does not have to exist for you to define it as a node. You can define nodes that represent scripts you plan to record or write at a later date. A JST, however, must exist for you to reference it as a test name.
The node appears as a box with the script or JST title inside. If this is the first node you created for this test, it appears in blue to indicate that it is the root node.
The Run Test button is a short-cut to the Run Test command on the main menu. When you click this button, the Run Test dialog window appears, with your JST name already filled into the Test Name field.
You can now run the test as usual. Because you're running a JST, the JST Runner window appears with the Record/Playback window and your program under test. The JST Runner shows how JavaStar is progressing through the nodes (including nested JSTs) by flashing the currently executing node. If the test ends prematurely, you can see which node contains the problem, and edit it in the Test Composer or Script Editor, depending on the nature of the problem.
For information on how to use the Run Test window, see the chapter "Running Tests."
Duplicating nodes is often useful, especially when you are creating a test that calls one script multiple times, changing only the parameters it sends with each call. All you have to do is duplicate and then edit the node.
Note - You cannot delete a root node. If you want to delete a node currently set to root, first define another node as the root node (see Choosing a Root Node) then delete the original node.
Restart nodes specify that when the JavaStar reaches this node during playback, the application under test will be restarted before executing the script (or JST) referred to by the node.
While you may have many reasons to restart a node during normal test functioning, the most common use is to handle exception conditions. By restarting the application, you return the test program to a predictable state, from which you can resume testing. Populating JSTs with exception conditions that link to restart nodes makes it easier to create long tests that run unattended--perhaps overnight--with reasonable assurance that the tests will complete, even with failures.
To set a node to restart:
To remove the restart condition from a node, you repeat the same procedure:
A root node is the starting node for the test. You must have a root node for your test, and you can only define one node as the root. By default, the first node you create for a test is a root node. If you want to change the root node:
You link nodes together using normal and exception connecting lines, represented by green (normal) and red (exception) arrows.
A normal connecting line between two nodes means that the second node will only be executed if the first node ends normally. A normal condition means that the previous test did not throw an exception. This does not mean that all comparisons passed, because while a synchronization failure throws a specific exception, verification failures do not throw exceptions (though details are included in the test run log file).
An exception connecting line means the second node will only be executed if the first node ends with an exception. An exception condition means the script was terminated prematurely when an operation threw an exception. Exception connectors are particularly useful for introducing error recover into your tests--in combination with Setting a Node to Restart, your tests become quite powerful.
You can only have one normal and one exception condition starting at each node. There is no limit, however, on the number of lines of one type that connect to a single node.
To create a condition line:
Use the comments field to explain the purpose of this JST and any important information other test developers might need to know when maintaining this test.
In the Compose Test window, you can select any node and specify arguments you want to pass to it at execution time. JavaStar supports three types of arguments (also called parameters):
This section describes the basics of how to specify parameters for a node within a JST. For a detailed description of how to use parameters to make your tests more flexible or how to edit scripts to support parameters, see the
JavaStar Tutorial.
To edit a node:
Edit Node dialog
The pull-down menu to the right of the Value or Argument# field (set to Constant by default) provides three options. The label for the field to the left of the parameter type pull-down changes based on your choice--by default, the field label is Value.
1
as the argument number.
Note - For property files, you need to specify the name of the property file in JavaStar Playback Options. You can only have one property file defined at one time.
A commented node that defines five parent parameters.
With the edit node window open, you can delete a parameter, change the value, insert a parameter into the list.
Send feedback to
JavaStar-feedback@suntest.com
Copyright © 1998
Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303.
All rights reserved.