Join us for ⁠#Android11: The Beta Launch Show on June 3!
Added in API level 1

TestResult

open class TestResult
kotlin.Any
   ↳ junit.framework.TestResult

A TestResult collects the results of executing a test case. It is an instance of the Collecting Parameter pattern. The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like an ArrayIndexOutOfBoundsException.

Summary

Public constructors

Public methods

open Unit
addError(test: Test!, t: Throwable!)

Adds an error to the list of errors.

open Unit

Adds a failure to the list of failures.

open Unit

Registers a TestListener

open Unit
endTest(test: Test!)

Informs the result that a test was completed.

open Int

Gets the number of detected errors.

open Enumeration<TestFailure!>!

Returns an Enumeration for the errors

open Int

Gets the number of detected failures.

open Enumeration<TestFailure!>!

Returns an Enumeration for the failures

open Unit

Unregisters a TestListener

open Int

Gets the number of run tests.

open Unit

Runs a TestCase.

open Boolean

Checks whether the test run should stop

open Unit
startTest(test: Test!)

Informs the result that a test will be started.

open Unit

Marks that the test run should stop.

open Boolean

Returns whether the entire test was successful or not.

Protected methods

open Unit
run(test: TestCase!)

Runs a TestCase.

Properties

Vector<TestFailure!>!

Vector<TestFailure!>!

Vector<TestListener!>!

Int

Public constructors

<init>

Added in API level 1
TestResult()

Public methods

addError

Added in API level 1
open fun addError(
    test: Test!,
    t: Throwable!
): Unit

Adds an error to the list of errors. The passed in exception caused the error.

addFailure

Added in API level 1
open fun addFailure(
    test: Test!,
    t: AssertionFailedError!
): Unit

Adds a failure to the list of failures. The passed in exception caused the failure.

addListener

Added in API level 1
open fun addListener(listener: TestListener!): Unit

Registers a TestListener

endTest

Added in API level 1
open fun endTest(test: Test!): Unit

Informs the result that a test was completed.

errorCount

Added in API level 1
open fun errorCount(): Int

Gets the number of detected errors.

errors

Added in API level 1
open fun errors(): Enumeration<TestFailure!>!

Returns an Enumeration for the errors

failureCount

Added in API level 1
open fun failureCount(): Int

Gets the number of detected failures.

failures

Added in API level 1
open fun failures(): Enumeration<TestFailure!>!

Returns an Enumeration for the failures

removeListener

Added in API level 1
open fun removeListener(listener: TestListener!): Unit

Unregisters a TestListener

runCount

Added in API level 1
open fun runCount(): Int

Gets the number of run tests.

runProtected

Added in API level 1
open fun runProtected(
    test: Test!,
    p: Protectable!
): Unit

Runs a TestCase.

shouldStop

Added in API level 1
open fun shouldStop(): Boolean

Checks whether the test run should stop

startTest

Added in API level 1
open fun startTest(test: Test!): Unit

Informs the result that a test will be started.

stop

Added in API level 1
open fun stop(): Unit

Marks that the test run should stop.

wasSuccessful

Added in API level 1
open fun wasSuccessful(): Boolean

Returns whether the entire test was successful or not.

Protected methods

run

Added in API level 1
protected open fun run(test: TestCase!): Unit

Runs a TestCase.

Properties

fErrors

Added in API level 1
protected var fErrors: Vector<TestFailure!>!

fFailures

Added in API level 1
protected var fFailures: Vector<TestFailure!>!

fListeners

Added in API level 1
protected var fListeners: Vector<TestListener!>!

fRunTests

Added in API level 1
protected var fRunTests: Int