junit.framework
クラス TestResult

java.lang.Object
  |
  +--junit.framework.TestResult

public class TestResult
extends java.lang.Object

TestResult クラスは、あるテストケースの実行結果を保持します。 このクラスは、Collecting Parameter パターンを実装しています。

JUnitフレームワークは、このクラスから、 検証の失敗(failures) または、 テスト実行時のエラー(errors) を判断します。 「検証の失敗」とは、検証動作時の想定内で、予測通りに動作しなかったことを表します。 「テスト実行時のエラー」は、 ArrayIndexOutOfBoundsException のように 検証動作時の想定外のエラーを表します。

関連項目:
Test

フィールドの概要
protected  java.util.Vector fErrors
           
protected  java.util.Vector fFailures
           
protected  java.util.Vector fListeners
           
protected  int fRunTests
           
 
コンストラクタの概要
TestResult()
           
 
メソッドの概要
 void addError(Test test, java.lang.Throwable t)
          エラーリストに、発生したテスト実行時のエラーを追加します。
 void addFailure(Test test, AssertionFailedError t)
          失敗リストに、発生した検証の失敗を表す AssertionFailedError オブジェクトを追加します。
 void addListener(TestListener listener)
          TestListenerオブジェクトを登録します。
 void endTest(Test test)
          テストが完了したことを通知します。
 int errorCount()
          テスト実行中に検出したエラー(errors)数を返却します。
 java.util.Enumeration errors()
          テスト実行時のエラー(errors)のEnumerationを返却します。
 int failureCount()
          テスト実行中に検出された検証の失敗(failures)の数を取得します。
 java.util.Enumeration failures()
          検証の失敗(failures)のEnumerationを返却します。
 void removeListener(TestListener listener)
          登録済みのTestListenerオブジェクトをリリースします。
protected  void run(TestCase test)
          TestCase を実行します。
 int runCount()
          実行テスト(Test)数を取得します。
 void runProtected(Test test, Protectable p)
          TestCase を実行します。
 boolean shouldStop()
          テストの実行を中止べきかチェックします。
 void startTest(Test test)
          テストの実行が開始されたことを通知します。
 void stop()
          テスト実行を中止すべき状態であることを(このオブジェクトの属性に)マークします。
 boolean wasSuccessful()
          全てのテストが成功したか、そうでないかを返却します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

fFailures

protected java.util.Vector fFailures

fErrors

protected java.util.Vector fErrors

fListeners

protected java.util.Vector fListeners

fRunTests

protected int fRunTests
コンストラクタの詳細

TestResult

public TestResult()
メソッドの詳細

addError

public void addError(Test test,
                     java.lang.Throwable t)
エラーリストに、発生したテスト実行時のエラーを追加します。 検証の失敗時には、呼び出されません。


addFailure

public void addFailure(Test test,
                       AssertionFailedError t)
失敗リストに、発生した検証の失敗を表す AssertionFailedError オブジェクトを追加します。 テスト実行時のエラーの発生時には、呼び出されません。


addListener

public void addListener(TestListener listener)
TestListenerオブジェクトを登録します。


removeListener

public void removeListener(TestListener listener)
登録済みのTestListenerオブジェクトをリリースします。


endTest

public void endTest(Test test)
テストが完了したことを通知します。


errorCount

public int errorCount()
テスト実行中に検出したエラー(errors)数を返却します。


errors

public java.util.Enumeration errors()
テスト実行時のエラー(errors)のEnumerationを返却します。


failureCount

public int failureCount()
テスト実行中に検出された検証の失敗(failures)の数を取得します。


failures

public java.util.Enumeration failures()
検証の失敗(failures)のEnumerationを返却します。


run

protected void run(TestCase test)
TestCase を実行します。 (訳者注)このクラスのrunProtectedメソッドを呼び出します。


runCount

public int runCount()
実行テスト(Test)数を取得します。


runProtected

public void runProtected(Test test,
                         Protectable p)
TestCase を実行します。


shouldStop

public boolean shouldStop()
テストの実行を中止べきかチェックします。

戻り値:
テストの実行を中止すべき場合は true、 そうでない場合は false

startTest

public void startTest(Test test)
テストの実行が開始されたことを通知します。


stop

public void stop()
テスト実行を中止すべき状態であることを(このオブジェクトの属性に)マークします。


wasSuccessful

public boolean wasSuccessful()
全てのテストが成功したか、そうでないかを返却します。

戻り値:
全てのテストが成功した場合は true、 そうでない場合は false