Creating Project Files: Defining Project Information


When you open JavaStar, the Project tab of Project Settings is displayed to the forefront by default (see Figure 3-2). This panel shows you the name of the project file and has an editable text area--Description--where you can describe the purpose of the file.

Note - The project file name is shown as a display-only field. To change the filename, you need to use the Save As... button. See the section "Saving, Applying, and Loading Project Files."

Project panel

By clicking on the tabs along the top of the Project Settings screen, you can bring other panels to the forefront. This section describes:

Providing Application or Applet Information

The App panel (Figure 3-3) is where you provide information about the program you want to test. For applications, you need to provide the name of the class file, any arguments the application requires, and the addendum to the CLASSPATH variable that JavaStar will use to locate the application. For applets, you need to provide the name of the HTML file that runs the applet.

To record or run a test, you do not have to provide this information in the project file. However, you can save yourself a lot of retyping if you enter the information here. If you will always be using the same application or applet in conjunction with this project file, or even if you will be using a particular program most of the time, go ahead and fill in the information here. When you later choose Create Test Script from the main menu, you'll have an opportunity to override these settings for that record/playback session.

App panel

To fill in application or applet information:

  1. Select the type of program you plan to test.
    Click either the Application or Applet radio button.

  2. If you are testing an application:

    1. In the Class field, type the name of the class to test.
      You can also use the Browse button to locate the class by navigating though the file dialog. If you type the name, you don't have to provide the .class extension.
      When you select the class name using the Browse button, JavaStar automatically enters the path to that class in the Classpath field.

    2. In the Args field, type any arguments you need to pass to the application.
      Enter these exactly as you would at the command line. If your application does not require arguments, leave this field blank.

  3. If you are testing an applet, enter the name of the html file for the applet.
    You can type the name directly into the Html file field, or use the Browse... button to locate the file using the file dialog.

Setting Test Options

The environment preferences affect the overall test environment. In the Test panel (see Figure 3-4) you define the directories you want JavaStar to use when generating tests and test results. You also define additional CLASSPATH settings, time out values, and delay values.

Test panel

Note - You can provide additional test options in the Adv. Test (Advanced Test) tab.

If you routinely store your tests in a directory other than the one where you start up JavaStar, type your test directory path in the Work directory field.

Field options:

Work directory The default directory where JavaStar stores your JSTs, scripts, and gold directories for those scripts.
Results directory The default directory where JavaStar stores the log files any failure data (from failed comparisons), as generated by your script.
JST path The directories you want JavaStar to search when finding the JSTs necessary to run a JST.
Test classpath The path to the directory containing the tests you want to run.
Time out The timeout value JavaStar uses when verifying comparisons and other JSComponent operations. When an operation fails, repeats its attempts until the timeout value is reached. By default, it is 30 seconds, but you can change it here.
Delay factor This value affects calls to JS.delay. If you recorded your script with delays, your script has JS.delay calls. When running a test script, JavaStar multiplies the delay factor by the JS.delay value defined in the script, and from there calculates the actual delay value. For example, if the value of JS.delay is 100 (milliseconds) and the value in the Delay field is 0, then the actual delay would be 0, but if the value in the Delay field is 2, then the actual delay would be 200 milliseconds. For more information about JS.delay, refer to the wrap(Component) description in the JavaStar API Reference.

Selecting Record Options

In the Record panel of the Project Settings window, you can set recording format options and select optional events you want JavaStar to record.

Record panel

Recording Format Options

The recording format options define how JavaStar generates code that uses components.

Use component names Turn this on if you're using setName().
Use regular expressions in title Automatically records references to frame titles as regular expressions. If your test program has windows that change titles, turning this option on can increase the chances that JavaStar will find the window even with a name change. However, if you have several windows titles starting with the same letter, this might cause a conflict during the test run.

Option Events to Include

Your settings under Optional Events to Include determine whether JavaStar records certain types of events. By default, JavaStar records none of these events on this list. This is useful in cases where your application does not process particular events--for example, the MOUSE_MOVE, MOUSE_ENTER, and MOUSE_EXIT events that are generated every time you move the mouse. If your application does process these events, then you should check the check boxes to activate this feature.

The event... Means the user
FOCUS_LOST is not focusing events on this object.
FOCUS_GAINED is focusing events on this object.
WINDOW_ICONIFIED minimized the application window to an icon.
WINDOW_DEICONIFIED restored the application to normal screen view.
MOUSE_ENTERED moved the mouse into the target object.
MOUSE_EXITED moved the mouse out of the target object.
MOUSE_MOVED is moving the mouse with no buttons pressed.
KEY_RELEASED finished pressing a key.

Specifying Java Options

The Java panel (see Figure 3-6) in the Project Settings screen is where you define information on the Java virtual machine and the compiler you want JavaStar to use when running and compiling tests. Based on the location of the JDK, JavaStar provides default paths for the JVM and the compiler. If you plan to use these locations, you don't need to fill in the fields. You only need to provide a path if you want to override the default.

Java panel

Java virtual machine The path to the JVM you use. Immediately below this text field, JavaStar displays (in italic) the default path that it will use if you do not specify a JVM.
Virtual machine args Any Java arguments you want to pass to the JVM. If you want to increase JVM memory, for example, you would use the -mx command here.
VM classpath flag The flag your JVM uses to preface a CLASSPATH setting. By default, this is -classpath.
Java compiler The complete path to the compiler you want JavaStar to use. Immediately below this text field, JavaStar displays (in italic) the default path that it will use if you do not specify a Java compiler.
Compiler args Any arguments you want to pass to the compiler when JavaStar compiles a test.
Compiler Classpath flag The flag your Java compiler uses to preface a CLASSPATH setting passed at the command line. By default, this is -classpath.
Java options:

Defining Locators, Declaration Classes, and Text Map Classes

Use the Mapping panel (see Figure 1-7) to define the names and paths to:

If you use the Edit List... buttons to select files for these fields, JavaStar will automatically update the Classpath field with the paths to each file you choose. The section, "Using the Selection Dialog" explains how to select files using Edit List.

Mapping panel

Non-Component Locators

When you test an application created using a toolkit that does not extend java.awt.Component, you need to provide JavaStar with a locator. This locator may be one you have written yourself or one provided with JavaStar. A locator is specific to a toolkit--for example, different locators are provided for Bongo, JFC, and IFC toolkits.

If you think your application or applet might need a locator, but you are unfamiliar with the locators available or don't know how to write one, see the chapter "Locators for Non-Components" for basic information. For an example of a locator and how you would use it, see the chapter, "Using Non-Component Locators" in the JavaStar Tutorial.

If you already have one or more locators to use with your program, you can use the Non component locators field (editing it with the Edit list... button) to specify the locators and have JavaStar add the location to the class path. For information on how to use the dialog that is displayed when you click Edit list..., see "Using the Selection Dialog."

Declaration Classes

If you plan to use declaration files to abstract GUI components, you need to provide the names of the declaration files and add them to the CLASSPATH environment variable. You can do this in this panel, using the Edit list... button to the right of the Declaration classes field. After you add declaration classes to the list, JavaStar fills in the Declaration classpath field with the directory paths that correspond to the files you selected.

For information on how to use the dialog that is displayed when you click Edit list..., see "Using the Selection Dialog."

For step-by-step instructions on how to create declaration files, see the chapter, "Generating and Using Declarations" in this User's Guide. For a discussion of how to use declaration files within the JavaStar test model, as well as an example, see the chapter "Generating Declarations" in the JavaStar Tutorial.

Text Map Classes

Text map classes are utilities you write that map components to text names. If your application or applet uses bit-mapped images for components or if it uses lightweight components of a custom design, you may want to create a text map so that your tests can extract a meaningful name for the component. In cases such as these, a text map can make tests and results easier to interpret.

For information on how to develop a text map, see the chapter, "Text Map Classes."

Using the Selection Dialog

To select files for either the Non component locators, Declaration classes, or Text map classes field:

  1. Click the Edit list button to the right of the text entry field.
    A Select dialog opens. See Figure 3-8.

    Select Dialog (this one is for Non component locators)

  2. In the Select an item panel, navigate to the directory containing the file you want to load, and select the file.
    For example, if you are selecting a locator, navigate to the javastar\contrib\locators directory and select the locator you want.
    The file name appears in the Edit list panel, in the Current Item field.

  3. Add the file to the list by clicking Add to list.
    The file is displayed in the Path list panel and in the list box of Edit list.

  4. Repeat Step 2 and Step 3 for any additional files you need to add to the list.
    If you have multiple files listed, you can move then up or down on the list, or delete them, using the buttons at the bottom of the Edit list panel.

  5. Click OK.
    JavaStar automatically enters the name of the class you selected into the text field for this file type, and the path to that class into Classpath field.

You can add additional locators using the Edit list... button.

Advanced Test Options

The Adv. Test panel (Figure 3-9) provides advanced options for controlling tests. Here you can control:

Advanced test options:

Hang time out The number of seconds you want JavaStar to wait before determining that an unresponsive application is hung.
Limit log The log file size at which JavaStar begins filtering.
Log filters Select log file options from this list to specify which information you want to exclude from your log files. Unlike filtering you can do after a log file is generated (using command line options or the Results Viewer Extract option) setting Log limit filters means that the options you choose are never recorded to the log.
Reload Classes Check this box if you want JavaStar to reload classes before executing a test. If you edit your tests while you have the Record/Playback window open, JavaStar will only reload the tests (and, thus, playback your changes) if you have this option turned on.
Prefixes (package/class) to ignore for source highlighter. Packages or classes you want to define as libraries, so they won't be shown during playback. Instead, the call to the library will be highlighted.




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