JET

edu.utep.cs.jet.gui.tester
Class DefaultTester

java.lang.Object
  extended by edu.utep.cs.jet.gui.tester.DefaultTester
All Implemented Interfaces:
Tester
Direct Known Subclasses:
ExperimentTester, Parser

public class DefaultTester
extends Object
implements Tester

The default tester class responsible for generating test cases dynamically and displaying them. This class implements both the view and the controller, and the view can be obtained by calling the getView() method. The test cases are generated by calling an external test case generation tool.

Version:
$Revision: 1.96 $
Author:
Yoonsik Cheon and Cesar Yeep

Field Summary
 
Fields inherited from interface edu.utep.cs.jet.gui.Constants
CLASS_EXTENSION, COLOR_EXPLORER, COLOR_OUTPUT, COPYRIGHT, DEBUG, EDIT_MENU_NAME, EXPLORER_DIR, EXPLORER_ROOT, FILE_MENU_NAME, HELP_MENU_NAME, ICON_ABOUT, ICON_ABSTRACT_CLASS, ICON_BROWSER, ICON_CLASS, ICON_CLASS_DISABLED, ICON_DELETE, ICON_ERROR, ICON_FILE, ICON_FOLDER, ICON_GEN_APP, ICON_HOME, ICON_INFORM, ICON_INTERFACE, ICON_JAVA_FILE, ICON_JML_LOGO, ICON_METHOD, ICON_METHOD_GREEN, ICON_METHOD_ORANGE, ICON_METHOD_RED, ICON_MINER, ICON_NEW, ICON_NEWTESTSUITE, ICON_NOTE, ICON_OPEN, ICON_OUTPUT, ICON_PREFERENCES, ICON_QUESTION, ICON_REDO, ICON_SAVE_AS, ICON_TEST_FILE, ICON_UNDO, ICON_UNKOWN, ICON_WARN, JAVA, JAVA_EXTENSION, JAVAC, JUNIT_SWINGGUI_TESTRUNNER, NEWLINE, OPTION_MENU_NAME, TEST_MENU_NAME, TITLE, TOOL_MENU_NAME, VERSION, WEB_PAGE_LOCATION, WEB_PAGE_NAME, WINDOW_HEIGHT, WINDOW_MIN_HEIGHT, WINDOW_MIN_WIDTH, WINDOW_WIDTH
 
Constructor Summary
DefaultTester()
          Creates a new instance.
 
Method Summary
 void addClassFileChangeListener(ClassFileChangeListener l)
          Registers the given class file change listener.
protected  TestCaseGenerationListener createTestCaseGenerationListener(edu.utep.cs.jet.gui.tester.EtMethod emeth)
          Creates a test case generation listener for testing the given method.
 JMenu createTestMenu(FileActionFactory fa, ToolActionFactory ta, String title)
          Creates a menu for the Test Menu.
protected  void doTest(Collection<?> meths)
          Tests all the methods contained in the given collecton.
protected  void doTest(edu.utep.cs.jet.gui.tester.EtMethod emeth)
          Tests the given method.
protected  boolean enableStatDialog()
          Returns true if the test statistics dialog has to be enabled.
 ExplorerComponent getExplorerView()
          Returns the view to be added to the explorer pane.
 OptionPanel getOptionPanel()
          Returns the option panel of this tester.
protected  AbstractAction getPopTest()
          Creates an action to generate test cases for the currently selected method or constructor.
protected  AbstractAction getPopTestAll()
          Creates an action to generate test cases for all the methods and constructors.
protected  AbstractAction getPopTestDeclared()
          Creates an action to generate test cases for the declared methods.
protected  AbstractAction getPopTestInherited()
          Creates an action to generate test cases for the inherited methods.
 JComponent getView()
          Returns the view of this tester.
 boolean loadFile(File file)
          Loads the given class file for testing and returns true if the file was loaded successfuly.
 void setDropTarget(DropTarget dropTarget)
          Associates a drop target with this tester so that its method names subpane accepts drops of class files.
 void setHideViewAction(AbstractAction action)
          Given the action that hide this editor's view, provides an appropriate user interface for it, such as a popup menu.
 void setSourceCodeViewer(SourceCodeViewer viewer)
          Sets the the source code viewer to locate and highlight the source code lines corresponding to the error messages obtained from the test case generation tool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTester

public DefaultTester()
Creates a new instance.

Method Detail

getView

public JComponent getView()
Returns the view of this tester. The returned view may be added to other containder widgets, such as JPanel.

Specified by:
getView in interface Tester

getExplorerView

public ExplorerComponent getExplorerView()
Returns the view to be added to the explorer pane. Null is returned if no such view is provided by this tester.

Specified by:
getExplorerView in interface Tester

getOptionPanel

public OptionPanel getOptionPanel()
Returns the option panel of this tester.

Specified by:
getOptionPanel in interface Tester

loadFile

public boolean loadFile(File file)
Loads the given class file for testing and returns true if the file was loaded successfuly. All the public methods and constructors will be read and displayed for testing.

Specified by:
loadFile in interface Tester

addClassFileChangeListener

public void addClassFileChangeListener(ClassFileChangeListener l)
Registers the given class file change listener. The listener will be notified when a new class file is loaded by the tester.

Specified by:
addClassFileChangeListener in interface Tester

setSourceCodeViewer

public void setSourceCodeViewer(SourceCodeViewer viewer)
Sets the the source code viewer to locate and highlight the source code lines corresponding to the error messages obtained from the test case generation tool.

Specified by:
setSourceCodeViewer in interface Tester

setDropTarget

public void setDropTarget(DropTarget dropTarget)
Associates a drop target with this tester so that its method names subpane accepts drops of class files.

Specified by:
setDropTarget in interface Tester

setHideViewAction

public void setHideViewAction(AbstractAction action)
Given the action that hide this editor's view, provides an appropriate user interface for it, such as a popup menu.

Specified by:
setHideViewAction in interface Tester

createTestCaseGenerationListener

protected TestCaseGenerationListener createTestCaseGenerationListener(edu.utep.cs.jet.gui.tester.EtMethod emeth)
Creates a test case generation listener for testing the given method. This is a hook method that can be overridden by subclass. For example, a subclass can override this method to collect experimental test statistics.


createTestMenu

public JMenu createTestMenu(FileActionFactory fa,
                            ToolActionFactory ta,
                            String title)
Creates a menu for the Test Menu.

Specified by:
createTestMenu in interface Tester

getPopTest

protected AbstractAction getPopTest()
Creates an action to generate test cases for the currently selected method or constructor.


getPopTestInherited

protected AbstractAction getPopTestInherited()
Creates an action to generate test cases for the inherited methods.


getPopTestDeclared

protected AbstractAction getPopTestDeclared()
Creates an action to generate test cases for the declared methods.


getPopTestAll

protected AbstractAction getPopTestAll()
Creates an action to generate test cases for all the methods and constructors.


doTest

protected void doTest(Collection<?> meths)
Tests all the methods contained in the given collecton. All the tests are executed in a new thread.


doTest

protected void doTest(edu.utep.cs.jet.gui.tester.EtMethod emeth)
Tests the given method.


enableStatDialog

protected boolean enableStatDialog()
Returns true if the test statistics dialog has to be enabled.


JET

JET is Copyright (C) 2005-2008 by The University of Texas at El Paso and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.