Generating Declarations: Debugging Test Run Errors Caused by GUI Changes


Declarations address problems that arise when the components in the test program's GUI change during development.

  1. From the JavaStar main menu, click Run test.

  2. For Test name, type TestNameDB.

  3. Start the test.
    Watch the Name Database main window as the test executes. It fills in each field with the test data until it gets to the Phone field--then it skips to the Email field and enters the phone information there (see Figure 4-1 on page 43).

    Name Database main window during playback
    Once the test fills in the Other field, it attempts to Tab to the next field. Here is where it pauses, then (according to whatever timeout value you have selected) the script ends. The Record/Playback window shows the exception thrown by the script.

    Record/Playback window with exception information

  4. Investigate the problem.
    The Record/Playback window provides the following information on the failure:

    From here you can see that JavaStar found only five TextField components, not the six TextFields that the script expected. This tells you where the script failed, but not why it passed up the Phone field. Your next step is to find out the type of the Phone field.

  5. Inspect the GUI.
    You can examine any component of your GUI without leaving Record/Playback mode and without having to examine the script. At this point, while your test has stopped, the Record/Playback window is still open. To examine the GUI:

    1. Click Interact.
      This allows you to work directly with the application without recording or playing back a script.

    2. Click the Inspect button.
      This button appears in the lower left button panel. It is enabled only after you select Interact. Clicking Inspect opens the "Select an object to inspect" panel in the right side of the window.

    3. Click in the Phone field of the Name Database.
      You may need to drag the test program to one side to see both windows at once. When you click in the text field, the field should flash to confirm your selection. The code for the selection also appears in the Select an object to inspect panel.

      Select for Inspection window with Name field selected
      This code shows:

        (TelephoneTF) -
        JS.frame("Name Database").member("TelephoneTF");

      This code reveals the problem: The TestNameDB script is trying to enter the phone data into a text field, but the application has been modified to change the Phone TextField to a component of type TelephoneTF. Unable to enter a string into a TelephoneTF, the script skips to the next TextField (Email) and enters the text field there. By the time it attempts to enter data for the Other field, no more text fields remain.
      To fix this problem, it seems you have to examine every reference to the text fields in this window and edit the component references to accommodate the type change. If you had multiple tests, that could be a lot of work. However, if you had generated component declarations for the application, you'd only need to change one file to update all scripts to use the correct types.

  6. Click Stop to end inspect mode.

  7. Quit the Record/Playback window.



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