junit.awtui
Class TestRunner

java.lang.Object
  |
  +--junit.runner.BaseTestRunner
        |
        +--junit.awtui.TestRunner
All Implemented Interfaces:
TestListener

public class TestRunner
extends BaseTestRunner

An AWT based user interface to run tests. Enter the name of a class which either provides a static suite method or is a subclass of TestCase.

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


Field Summary
protected  java.util.Vector fExceptions
           
protected  java.util.Vector fFailedTests
           
protected  java.awt.List fFailureList
           
protected  java.awt.Frame fFrame
           
protected  Logo fLogo
           
protected  java.awt.Label fNumberOfErrors
           
protected  java.awt.Label fNumberOfFailures
           
protected  java.awt.Label fNumberOfRuns
           
protected  ProgressBar fProgressIndicator
           
protected  java.awt.Button fQuitButton
           
protected  java.awt.Button fRerunButton
           
protected  java.awt.Button fRun
           
protected  java.lang.Thread fRunner
           
protected  java.awt.TextField fStatusLine
           
protected  java.awt.TextField fSuiteField
           
protected  TestResult fTestResult
           
protected  java.awt.TextArea fTraceArea
           
protected  java.awt.Checkbox fUseLoadingRunner
           
private static int GAP
           
protected static java.awt.Font PLAIN_FONT
           
 
Fields inherited from class junit.runner.BaseTestRunner
SUITE_METHODNAME
 
Constructor Summary
TestRunner()
           
 
Method Summary
private  void about()
           
protected  void addGrid(java.awt.Panel p, java.awt.Component co, int x, int y, int w, int fill, double wx, int anchor)
           
private  void addToCounterPanel(java.awt.Panel counter, java.awt.Component comp, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, java.awt.Insets insets)
           
private  void appendFailure(java.lang.String kind, Test test, java.lang.Throwable t)
           
protected  void clearStatus()
          Clears the status message.
protected  java.awt.Panel createCounterPanel()
           
protected  java.awt.Menu createJUnitMenu()
          Creates the JUnit menu.
protected  void createMenus(java.awt.MenuBar mb)
           
protected  TestResult createTestResult()
           
protected  java.awt.Frame createUI(java.lang.String suiteName)
           
 void failureSelected()
           
 java.lang.Thread getRunner()
           
private  boolean isErrorSelected()
           
private  java.awt.Image loadFrameIcon()
           
static void main(java.lang.String[] args)
           
 void rerun()
           
private  void rerunTest(Test test)
           
protected  void reset()
           
static void run(java.lang.Class test)
           
protected  void runFailed(java.lang.String message)
          Override to define how to handle a failed loading of a test suite.
 void runSuite()
           
private  void setLabelValue(java.awt.Label label, int value)
           
 void setSuiteName(java.lang.String suite)
           
private  boolean shouldReload()
           
private  void showErrorTrace()
           
private  void showInfo(java.lang.String message)
           
private  void showStatus(java.lang.String status)
           
 void start(java.lang.String[] args)
          Starts the TestRunner
 void testEnded(java.lang.String testName)
           
 void testFailed(int status, Test test, java.lang.Throwable t)
           
 void testStarted(java.lang.String testName)
           
 
Methods inherited from class junit.runner.BaseTestRunner
addError, addFailure, elapsedTimeAsString, endTest, extractClassName, getFilteredTrace, getFilteredTrace, getLoader, getPreference, getPreference, getPreferences, getTest, inVAJava, loadSuiteClass, processArguments, savePreferences, setLoading, setPreference, setPreferences, showStackRaw, startTest, truncate, useReloadingTestSuiteLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fFrame

protected java.awt.Frame fFrame

fExceptions

protected java.util.Vector fExceptions

fFailedTests

protected java.util.Vector fFailedTests

fRunner

protected java.lang.Thread fRunner

fTestResult

protected TestResult fTestResult

fTraceArea

protected java.awt.TextArea fTraceArea

fSuiteField

protected java.awt.TextField fSuiteField

fRun

protected java.awt.Button fRun

fProgressIndicator

protected ProgressBar fProgressIndicator

fFailureList

protected java.awt.List fFailureList

fLogo

protected Logo fLogo

fNumberOfErrors

protected java.awt.Label fNumberOfErrors

fNumberOfFailures

protected java.awt.Label fNumberOfFailures

fNumberOfRuns

protected java.awt.Label fNumberOfRuns

fQuitButton

protected java.awt.Button fQuitButton

fRerunButton

protected java.awt.Button fRerunButton

fStatusLine

protected java.awt.TextField fStatusLine

fUseLoadingRunner

protected java.awt.Checkbox fUseLoadingRunner

PLAIN_FONT

protected static final java.awt.Font PLAIN_FONT

GAP

private static final int GAP
See Also:
Constant Field Values
Constructor Detail

TestRunner

public TestRunner()
Method Detail

about

private void about()

testStarted

public void testStarted(java.lang.String testName)
Specified by:
testStarted in class BaseTestRunner

testEnded

public void testEnded(java.lang.String testName)
Specified by:
testEnded in class BaseTestRunner

testFailed

public void testFailed(int status,
                       Test test,
                       java.lang.Throwable t)
Specified by:
testFailed in class BaseTestRunner

addGrid

protected void addGrid(java.awt.Panel p,
                       java.awt.Component co,
                       int x,
                       int y,
                       int w,
                       int fill,
                       double wx,
                       int anchor)

appendFailure

private void appendFailure(java.lang.String kind,
                           Test test,
                           java.lang.Throwable t)

createJUnitMenu

protected java.awt.Menu createJUnitMenu()
Creates the JUnit menu. Clients override this method to add additional menu items.


createMenus

protected void createMenus(java.awt.MenuBar mb)

createTestResult

protected TestResult createTestResult()

createUI

protected java.awt.Frame createUI(java.lang.String suiteName)

createCounterPanel

protected java.awt.Panel createCounterPanel()

addToCounterPanel

private void addToCounterPanel(java.awt.Panel counter,
                               java.awt.Component comp,
                               int gridx,
                               int gridy,
                               int gridwidth,
                               int gridheight,
                               double weightx,
                               double weighty,
                               int anchor,
                               int fill,
                               java.awt.Insets insets)

failureSelected

public void failureSelected()

isErrorSelected

private boolean isErrorSelected()

loadFrameIcon

private java.awt.Image loadFrameIcon()

getRunner

public java.lang.Thread getRunner()

main

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

run

public static void run(java.lang.Class test)

rerun

public void rerun()

rerunTest

private void rerunTest(Test test)

reset

protected void reset()

runFailed

protected void runFailed(java.lang.String message)
Description copied from class: BaseTestRunner
Override to define how to handle a failed loading of a test suite.

Specified by:
runFailed in class BaseTestRunner

runSuite

public void runSuite()

shouldReload

private boolean shouldReload()

setLabelValue

private void setLabelValue(java.awt.Label label,
                           int value)

setSuiteName

public void setSuiteName(java.lang.String suite)

showErrorTrace

private void showErrorTrace()

showInfo

private void showInfo(java.lang.String message)

clearStatus

protected void clearStatus()
Description copied from class: BaseTestRunner
Clears the status message.

Overrides:
clearStatus in class BaseTestRunner

showStatus

private void showStatus(java.lang.String status)

start

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



Copyright 1997-2004 JUnit.org. All Rights Reserved.