Generating Declarations: Recording New Scripts that Use Declaration Files


For this part of the lesson you'll create a small script that exercises several components. Because you'll be re-designing TestNameDB in the next lesson, this test serves as an example and is not one you'll keep in the revised test suite. All the tests you create from this point in the tutorial will use the declaration files.

Note - If you want to use declaration files with existing tests, you can modify the code manually to incorporate them. For instructions, see the chapter, "Generating and Using Declarations" in the JavaStar User's Manual.

  1. From the main menu, choose Create Test Script.

  2. Start the namedb application.

  3. Click Record.

  4. In the Create script field, enter SimpleAdd.

  5. To the right of the Record with map files field, click the Map list button.
    The Select Map Classes dialog is displayed. Map is another name for declaration files.

  6. Using the file panel in the left portion of the window, navigate to and expand the \tutorial\NameData directory.

  7. Select each of the declaration files and add it to the list.

    1. Click on MainWin.class.
      The class name appears in the upper right panel as the current item.

    2. Click the Add to list button.
      MainWin.class is added to the list in the right panel and to the field at the bottom of the window.

    3. Repeat Step a and Step b for NamesWin.class and SearchWin.class.

  8. In the Select Map dialog, click OK.

  9. In the Record test script dialog, click OK.

  10. In the Name Database window, open the test.db file.
    Click Open, locate and select test.db, and click Open again.

  11. In the same window, click Clear.

  12. Enter a new record into the name database.
    Type data into each field of the record and click Add.

  13. In the Record/Playback window, click Stop.

  14. Examine the play() method of the script (shown in the log panel to the right of the Record/Playback window) to see the declarations.
    Though the mouse coordinates may differ in your code, the beginning lines of play() should look similar to this:
    The same test recorded without using the declaration files would look like this:

  15. Quit the Record/Playback window and confirm that you want to end all processes.
    Click Quit, then click OK in the confirmation dialog.



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