Empirical Test Application User Manual
 

 

Introduction

The Empirical Test Application is a program to aid the user in testing Java code.  When developing an object, a developer must create a separate object in order to test the created object.  The Empirical Test Application will eliminate the need for the user to code his own objects to test the created objects.

The Empirical Test Application allows the user to load in a java class file and test the functionality of it by conducting a series of tests, which would invoke various aspects in a user defined order.

The program allows the user to invoke all the aspects of a declared class as well as all inherited classes including:

The process of invoking data members will include the ability to: The process of invoking methods will include the ability to: The process of invoking constructors will include the ability to:

Functional Requirements

  1. The program will provide the user with a status window to display various messages about the program's state and exercised functionality
  2. The program prompts the user to enter a class path for a class to be tested
  3. With a valid class path, the program loads in the class and populates the fields and methods panels with the appropriate data
  4. When an invalid class path is entered, an error message is displayed for the user asking them to re-enter a valid class path
  5. With a valid test class loaded, the program allows the user to create test data items to be used to instantiate the main test class
  6. The program allows the user to create Java primitive test data items
  7. The program allows the user to create Java test data items derived from 'Object'
  8. The program allows the user to construct Test Data Items to be used as objects to be passed into methods of the Main Test Class
  9. The program allows the user to pass primitive test data items into methods of the Main Test Class for testing purposes
  10. The program allows the test data items to be stored in the Object Pool for later use
  11. The program allows the user to delete test data items from the Object pool that the user no longer needs
  12. The program allows the user to invoke methods of the Main Test Class
  13. The program allows the user to store values returned from invoked methods of the Main Test Class
  14. The program allows the user to delete values returned from invoking methods of the Main Test Class
  15. The program allows the user to inspect the values of data returned from invoking methods of the Main Test Class
  16. The program allows the user to change the name and value of test data items
  17. The program allows the user to view and save a log of the testing activity so far
  18. The program allows the user to invoke the constructor of the loaded class
  19. The program will allow the user to determine the datatype of the fields of the Main Test Class
  20. The program will allow the user to determine the parameters of each method of the Main Test Class

Getting Started

The Empirical Test Application requires at least version 1.2 of the Java Runtime Environment.  If you do not have this you can find the Windows version here:

http://java.sun.com/products/jdk/1.2/download-windows.html
 
 

Description of User Interface

The main window of the program includes a menu, an Object Pool panel, a Methods panel, a Fields panel, a Status panel, and a Component Preview (if applicable).
 
 

 

 

Menus

The File menu contains two options.

Open Class: Selecting Open Class will present the user with an 'Open Class' Dialog box in which the user can specify a class to open.
 
 

Picture of the Open Class dialog box using example class Integer.


 
 

If the entered class path is not valid, a new dialog will be displayed with an error message and prompt you for a new class.
 
 

Picture of the Open Class dialog after the user has entered an invalid class path.


 
 

Exit: Selecting Exit will close the program.
 
 

The Test menu contains three options.
 

Instantiate Main Test Class: The Instantiate menu option will display the name of the class to be instantiated. For example, if the user has opened the java.lang.Integer class, the menu will be "Instantiate java.lang.Integer" Selecting the instantiate option will present the user with a dialog box in which the user can pick a constructor to instantiate the loaded class with. If the selected constructor takes parameters, there are combo boxes to allow the user to select objects in the Object Pool to use as parameters for the constructor. There is also a text field in which the user can specify a name for the newely instantiated class. The default for this is the name of the class. After the user instantiates the class, a new item will appear in the Test Data Items Tab of the Object Pool.
 
 

Picture of the Instantiate Class dialog box using example class Integer.


 
 New Test Data Item: Selecting New Test Data Item will bring up the New Test Data Item Dialog (see Object Pool section).
 
 Clean All Test Data Items: The Clean All Test Data Items option is a convenience item to delete all user created parameter objects (leaves returned objects intact).
 
 

The Help menu contains two options.
 

Help Contents: The Help Contents option will bring up the help information. (the format has not yet been decided)

About: The About option will display information about the program (eg who wrote it).

Keyboard Shortcuts

The following keyboard shortcuts exist within the program:
 
 
Keyboard Shortcut
Action
Crtl-O
Open Class
Crtl-X
Exit
Crtl-A
Instantiate
Crtl-N
New Test Data Item
Crtl-E
Clean All Test Data Items

 

Object Pool

The Object Pool panel has lists of all the created objects and objects that have been returned from invoked methods.  At the top of the panel are two tabs, Test Data Items and Returned Objects.  The selected tab will display the appropriate list in the panel.  Information that is displayed includes object type, name, and value. The name field for all Test Data Items and the value field of primitive Test Data Items will be shaded gray when they are not being edited. To change/edit a name or a value, simply make your change in the text field and press the 'enter' key. You can cancel any changes you have made by pressing the 'escape' key or by clicking on a different part of the program. If the test data item is an object, an inspect button will be visible. Clicking on this button will allow the user to view the object in a similar manner to how the ETA works.
 
 

Picture of the Object Pool panel with the Test Data Items tab selected.
Note the white text field on the boolean value because it is being edited.


 
 

When the Returned Objects tab is selected, there are two buttons at the bottom.  One is the Remove button that will remove the selected object from the pool.  The other button is the 'Move to Test Data Items' button.  This button will move the selected object to the test data items pool. There, its value can be modified and passed to a method as a parameter just like any other test data item.

When the Test Data Items tab is selected, there are also two buttons at the bottom.  One of the buttons is the Remove button.  This will remove the selected object from the test data items pool.  The second button is the New Test Data Item button.  Clicking on the New Test Data Item button will pop up the New Test Data Item dialog box which will allow the user to specify the type, value, name, and whether or not the object is a primitive type or is derived from a specific object. Note: When setting the value of booleans the user must type 'true' (case insensitive) in order to make the value true. Anything else will default to a value of false.
 


Example of selecting Primitive Type of Derived from 'Object'
 
 

Example of creating an int object.


 
 

If the user selects 'Derived from object' new dialogs will appear to specify the object, constructor, and parameters if needed. If the selected constructor takes parameters, there are combo boxes that allow the user to select objects in the Object Pool to use as parameters for the constructor.
 
 

Example of creating a new Integer object.

Methods

The Methods panel contains information on function names and return types.  At the top of the Methods panel are tabs for the loaded class and the loaded class' hierarchy.  The selected tab represents which information is displayed.  Below these tabs are four additional tabs: Public, Protected, Private, and Packaged Local.  These tabs show the different types of methods depending on which tab is selected.  The information it shows includes the return type, name, parameter type, and modifiers.
 
 

The modifiers are represented by graphics:

Graphic
Modifier
Abstract
Final
Native
Static
Synchronized
Transient

 

The user can invoke the method by clicking on the name.  If the method returns an object it will be visible in the Returned Data Items section of the Object Pool. If the method requires a parameter then there will be a combo box that allows the user to specify a parameter from the Object Pool. A method name will only enable when valid parameters have been set.
 
 

Picture of the Methods panel with the Integer class loaded.
Note that the enabled methods have valid parameters set.


 
 

Fields

At the top of the Fields panel are tabs for the loaded class and any classes from which it is inherited.  The Fields panel also contains Public, Protected, Private, and Packaged Local tabs.  These tabs act similar to the tabs in the Methods panel in that depending on which are selected, the appropriate fields will be displayed.  The information it shows includes the field type, modifiers, name, and value.  To return the value of the field, the user can click on the name.
 
 

Clicking on the name of a field will place a copy of the field in the Test Data Items section of the Object Pool. By looking at the new test data item the user can see the current value of the field. A Values combo box exists next the the field name. This combo box will list all valid test data items that the respective field could be set to. By clicking on one of the values in the list, the user can set the value of the field.
 
 

Picture of the Fields panel with the Integer class loaded.


 
 

Status

The status panel has three tabs: Output, Messages, and Session Log. The Output tab will display any output from the loaded class, while the Messages tab will display any messages from the ETA program. If a new message is received on one of the panels while the user has a different tab selected, the unselected tab will turn red to alert the user that a new message has been received. Once the user clicks on the tab it will go back to normal color.
 
 

The ETA program will save log files of the status panels. A separate log file will be created for each panel in the same directory as the ETA.jar file.
 
 

 Picture of the Status panel with the Session Log shown after a user has performed various actions.
Note the Messages tab is colored red because it has received new information that the user has not yet seen.


 
 

The Session Log tab will display a log that contains a record of what the user has done since starting the program. Entries in the session log consist of the time (in 24-hour format) and the event happened and what the event is.
Logged Event Example Session Log Entry
Opening a class [02:34] Open class 'java.lang.integer'
Instantiating a class [12:23] Instantiate class - 'java.lang.Integer(userCreatedInt1)
Creating a test data item [06:32] Create Test Data Item 'tempFoo' - Foo(intFive, intSix, intSeven)
[06:35] Create Test Data Item 'intEight' - int with value 8
Changing the name of a test data item [07:39] Rename 'tempFoo' to 'niftyFoo'
Changing the value of a test data item [10:54] Change 'tempInt' value to 5
Deleting a test data item [23:00] Delete 'tempInt'
Moving a Returned Object to the list of test data items [13:24] Move 'returnedString' to Test Data Item list
Invoking a method [08:17] Invoked setXY(intFive, intSix)
Getting the value of a field [03:31] Get Field Value - x
Setting the value of a field [12:34] Set Field Value - x to intFive
Inspecting a test data item or returned object [13:57] Inspect 'tempFoo'
[13:59] End Inspect
Removing a returned data item [14:10] Remove Returned Data Item 'java.lang.String.getBytes'

 
 

Component Preview

The Component Preview panel will be displayed and will generate a preview of the loaded class if it is derived from java.awt.component.  If the loaded class is not derived from java.awt.component then the Component Preview panel will not be visible.
 
 

Tutorial / Walk Through / Use Cases

A detailed walk through including many screen shots can be found online at:

http://cobra.csc.calpoly.edu/~team_4/etaproto1.htmll
 
 
 


Date Author Change
3/12 pshansen updated some screenshots to show keyboard shortcuts and the status tab coloring
3/10 pshansen updated information to make it consisten with Staged Delivery Plan
3/6 wsstrick Added general requirement of invoking a method
3/2 pshansen updated to reflect new changes
2/21 pshansen major update - updated many areas that were outdated, added a few new
pictures, added a section that explains the modifiers graphics, added a
Functional Requirements section that lists the requirements
2/12 mhebron updated description of Instantiate Main Test Class menu option
2/11 pshansen updated screenshots to be current with program
2/11 pshansen documented the behavior of setting boolean values (defect 504863)
2/11 pshansen add help menu (defect 504786)
2/03 pshansen revised to maintain consistency, updated screenshots
1/30 mhebron cosmetic changes, added explanation of session log
11/28 pshansen revised to maintain consistency with our project
11/01 pshansen revised
10/18 pshansen revised to reflect prototype changes
10/18 pshansen additional revision after Formal Technical Review
10/17 pshansen revised after Formal Technical Review
10/15 pshansen revised to reflect new prototype
10/10 pshansen revised
10/7 ph/ws created
03/12 ayahinia revised