junit.swingui
Class TestRunner

java.lang.Object
  |
  +--junit.swingui.TestRunner

public class TestRunner
extends java.lang.Object
implements TestListener, javax.swing.event.DocumentListener

A simple user interface to run tests. Enter the name of a class with a suite method which should return the tests to be run.

 Synopsis: java java.swingui.TestRunner [TestCase]
 
TestRunner takes as an optional argument the name of the testcase class to be run.


Field Summary
protected  javax.swing.JFrame fFrame
           
 
Constructor Summary
TestRunner()
           
 
Method Summary
 void addError(Test test, java.lang.Throwable t)
          An error occurred.
 void addFailure(Test test, java.lang.Throwable t)
          A failure occurred.
 void changedUpdate(javax.swing.event.DocumentEvent event)
           
protected  void connectTestBrowser(Test testSuite, boolean reload)
           
protected  javax.swing.JPanel createCounterPanel()
           
protected  javax.swing.JPanel createFailedPanel()
           
protected  javax.swing.JList createFailureList(javax.swing.ListModel model)
           
protected  javax.swing.JFrame createFrame(java.lang.String title)
           
protected  javax.swing.JMenu createJUnitMenu()
          Creates the JUnit menu.
protected  javax.swing.JLabel createLogo()
           
protected  void createMenus(javax.swing.JMenuBar mb)
           
protected  javax.swing.JButton createQuitButton()
           
protected  javax.swing.JButton createRunButton()
           
protected  java.awt.Component createRunExtension()
          Hook to plug in a UI component on the run line
protected  javax.swing.JTextField createStatusLine()
           
protected  javax.swing.JComboBox createSuiteCombo()
           
protected  TestResult createTestResult()
           
protected  javax.swing.JFrame createUI(java.lang.String suiteName)
           
 void endTest(Test test)
          A test ended.
protected  java.lang.String getSuiteText()
           
protected  Test getTest(java.lang.String suiteClassName)
          Loads the named test suite and returns it.
 void insertUpdate(javax.swing.event.DocumentEvent event)
           
protected  java.lang.Class loadSuiteClass(java.lang.String suiteClassName)
           
static void main(java.lang.String[] args)
          main entrypoint
 void removeUpdate(javax.swing.event.DocumentEvent event)
           
protected  void reset()
           
 void run()
          Deprecated. use runSuite() instead
 void runSuite()
           
protected  void runTest(Test testSuite)
           
 void setSuiteName(java.lang.String suite)
           
 void start(java.lang.String[] args, TestSuiteLoader loader)
          Starts the TestRunner
 void startTest(Test test)
          A test started.
 void terminate()
          Terminates the TestRunner
 void textChanged()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fFrame

protected javax.swing.JFrame fFrame
Constructor Detail

TestRunner

public TestRunner()
Method Detail

addError

public void addError(Test test,
                     java.lang.Throwable t)
Description copied from interface: TestListener
An error occurred.
Specified by:
addError in interface TestListener

addFailure

public void addFailure(Test test,
                       java.lang.Throwable t)
Description copied from interface: TestListener
A failure occurred.
Specified by:
addFailure in interface TestListener

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent event)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

connectTestBrowser

protected void connectTestBrowser(Test testSuite,
                                  boolean reload)

createCounterPanel

protected javax.swing.JPanel createCounterPanel()

createFailedPanel

protected javax.swing.JPanel createFailedPanel()

createFailureList

protected javax.swing.JList createFailureList(javax.swing.ListModel model)

createJUnitMenu

protected javax.swing.JMenu createJUnitMenu()
Creates the JUnit menu. Clients override this method to add additional menu items.

createFrame

protected javax.swing.JFrame createFrame(java.lang.String title)

createLogo

protected javax.swing.JLabel createLogo()

createMenus

protected void createMenus(javax.swing.JMenuBar mb)

createQuitButton

protected javax.swing.JButton createQuitButton()

createRunButton

protected javax.swing.JButton createRunButton()

createRunExtension

protected java.awt.Component createRunExtension()
Hook to plug in a UI component on the run line

createStatusLine

protected javax.swing.JTextField createStatusLine()

createSuiteCombo

protected javax.swing.JComboBox createSuiteCombo()

createTestResult

protected TestResult createTestResult()

createUI

protected javax.swing.JFrame createUI(java.lang.String suiteName)

endTest

public void endTest(Test test)
Description copied from interface: TestListener
A test ended.
Specified by:
endTest in interface TestListener

getSuiteText

protected java.lang.String getSuiteText()

getTest

protected Test getTest(java.lang.String suiteClassName)
Loads the named test suite and returns it. Errors during loading are reported on the status line.

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent event)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

loadSuiteClass

protected java.lang.Class loadSuiteClass(java.lang.String suiteClassName)
                                  throws java.lang.ClassNotFoundException

main

public static void main(java.lang.String[] args)
main entrypoint

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent event)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

reset

protected void reset()

run

public void run()
Deprecated. use runSuite() instead

runs a suite.

runSuite

public void runSuite()

runTest

protected void runTest(Test testSuite)

setSuiteName

public void setSuiteName(java.lang.String suite)

start

public void start(java.lang.String[] args,
                  TestSuiteLoader loader)
Starts the TestRunner

startTest

public void startTest(Test test)
Description copied from interface: TestListener
A test started.
Specified by:
startTest in interface TestListener

terminate

public void terminate()
Terminates the TestRunner

textChanged

public void textChanged()