junit.textui
クラス TestRunner

java.lang.Object
  拡張junit.runner.BaseTestRunner
      拡張junit.textui.TestRunner
すべての実装インタフェース:
TestListener

public class TestRunner
extends BaseTestRunner

A command line based tool to run tests.

 java junit.textui.TestRunner [-wait] TestCaseClass
 
TestRunner expects the name of a TestCase class as argument. If this class defines a static suite method it will be invoked and the returned test is run. Otherwise all the methods starting with "test" having no arguments are run.

When the wait command line argument is given TestRunner waits until the users types RETURN.

TestRunner prints a trace as the tests are executed followed by a summary at the end.


フィールドの概要
static int EXCEPTION_EXIT
           
static int FAILURE_EXIT
           
static int SUCCESS_EXIT
           
 
クラス junit.runner.BaseTestRunner から継承したフィールド
SUITE_METHODNAME
 
コンストラクタの概要
TestRunner()
          Constructs a TestRunner.
TestRunner(java.io.PrintStream writer)
          Constructs a TestRunner using the given stream for all the output
TestRunner(ResultPrinter printer)
          Constructs a TestRunner using the given ResultPrinter all the output
 
メソッドの概要
protected  TestResult createTestResult()
          Creates the TestResult to be used for the test run.
 TestResult doRun(Test test)
           
 TestResult doRun(Test suite, boolean wait)
           
 TestSuiteLoader getLoader()
          Always use the StandardTestSuiteLoader.
static void main(java.lang.String[] args)
           
protected  void pause(boolean wait)
           
static void run(java.lang.Class testClass)
          Runs a suite extracted from a TestCase subclass.
static TestResult run(Test test)
          Runs a single test and collects its results.
static void runAndWait(Test suite)
          Runs a single test and waits until the user types RETURN.
protected  void runFailed(java.lang.String message)
          Override to define how to handle a failed loading of a test suite.
 void setPrinter(ResultPrinter printer)
           
protected  TestResult start(java.lang.String[] args)
          Starts a test run.
 void testEnded(java.lang.String testName)
           
 void testFailed(int status, Test test, java.lang.Throwable t)
           
 void testStarted(java.lang.String testName)
           
 
クラス junit.runner.BaseTestRunner から継承したメソッド
addError, addFailure, clearStatus, elapsedTimeAsString, endTest, extractClassName, getFilteredTrace, getFilteredTrace, getPreference, getPreference, getPreferences, getTest, inMac, inVAJava, loadSuiteClass, processArguments, savePreferences, setLoading, setPreference, setPreferences, showStackRaw, startTest, truncate, useReloadingTestSuiteLoader
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

SUCCESS_EXIT

public static final int SUCCESS_EXIT
関連項目:
定数フィールド値

FAILURE_EXIT

public static final int FAILURE_EXIT
関連項目:
定数フィールド値

EXCEPTION_EXIT

public static final int EXCEPTION_EXIT
関連項目:
定数フィールド値
コンストラクタの詳細

TestRunner

public TestRunner()
Constructs a TestRunner.


TestRunner

public TestRunner(java.io.PrintStream writer)
Constructs a TestRunner using the given stream for all the output


TestRunner

public TestRunner(ResultPrinter printer)
Constructs a TestRunner using the given ResultPrinter all the output

メソッドの詳細

run

public static void run(java.lang.Class testClass)
Runs a suite extracted from a TestCase subclass.


run

public static TestResult run(Test test)
Runs a single test and collects its results. This method can be used to start a test run from your program.
 public static void main (String[] args) {
     test.textui.TestRunner.run(suite());
 }
 


runAndWait

public static void runAndWait(Test suite)
Runs a single test and waits until the user types RETURN.


getLoader

public TestSuiteLoader getLoader()
Always use the StandardTestSuiteLoader. Overridden from BaseTestRunner.

オーバーライド:
クラス BaseTestRunner 内の getLoader

testFailed

public void testFailed(int status,
                       Test test,
                       java.lang.Throwable t)
定義:
クラス BaseTestRunner 内の testFailed

testStarted

public void testStarted(java.lang.String testName)
定義:
クラス BaseTestRunner 内の testStarted

testEnded

public void testEnded(java.lang.String testName)
定義:
クラス BaseTestRunner 内の testEnded

createTestResult

protected TestResult createTestResult()
Creates the TestResult to be used for the test run.


doRun

public TestResult doRun(Test test)

doRun

public TestResult doRun(Test suite,
                        boolean wait)

pause

protected void pause(boolean wait)

main

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

start

protected TestResult start(java.lang.String[] args)
                    throws java.lang.Exception
Starts a test run. Analyzes the command line arguments and runs the given test suite.

例外:
java.lang.Exception

runFailed

protected void runFailed(java.lang.String message)
クラス BaseTestRunner の記述:
Override to define how to handle a failed loading of a test suite.

定義:
クラス BaseTestRunner 内の runFailed

setPrinter

public void setPrinter(ResultPrinter printer)


Copyright © 2001-2004 JUnit.org. All Rights Reserved.