{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

TestRunnable

class TestRunnable


Runnable to run a single am instrument command to execute a single test.

Summary

Nested types

TestRunnable.RunFinishedListener

Called at the end of a test run.

Public functions

TestRunnable
legacyTestRunnable(
    context: Context,
    secret: String,
    arguments: Bundle,
    outputStream: OutputStream,
    listener: TestRunnable.RunFinishedListener
)

Constructs a TestRunnable executes all tests in arguments.

Unit
run()
TestRunnable
singleTestRunnable(
    context: Context,
    secret: String,
    arguments: Bundle,
    outputStream: OutputStream,
    listener: TestRunnable.RunFinishedListener,
    test: String
)

Constructs a TestRunnable which will run a single test.

TestRunnable
testCollectionRunnable(
    context: Context,
    secret: String,
    arguments: Bundle,
    outputStream: OutputStream,
    listener: TestRunnable.RunFinishedListener
)

Constructs a TestRunnable which will ask the instrumentation to list out its tests.

Public functions

legacyTestRunnable

fun legacyTestRunnable(
    context: Context,
    secret: String,
    arguments: Bundle,
    outputStream: OutputStream,
    listener: TestRunnable.RunFinishedListener
): TestRunnable

Constructs a TestRunnable executes all tests in arguments.

Parameters
context: Context

A context

secret: String

A string representing the speakeasy binder key

arguments: Bundle

contains arguments to be passed to the target instrumentation

outputStream: OutputStream

the stream to write the results of the test process

listener: TestRunnable.RunFinishedListener

a callback listener to know when the run has completed

run

fun run(): Unit

singleTestRunnable

fun singleTestRunnable(
    context: Context,
    secret: String,
    arguments: Bundle,
    outputStream: OutputStream,
    listener: TestRunnable.RunFinishedListener,
    test: String
): TestRunnable

Constructs a TestRunnable which will run a single test.

Parameters
context: Context

A context

secret: String

A string representing the speakeasy binder key

arguments: Bundle

contains arguments to be passed to the target instrumentation

outputStream: OutputStream

the stream to write the results of the test process

listener: TestRunnable.RunFinishedListener

a callback listener to know when the run has completed

test: String

contains a specific test#method to run. Will override whatever is specified in the bundle.

testCollectionRunnable

fun testCollectionRunnable(
    context: Context,
    secret: String,
    arguments: Bundle,
    outputStream: OutputStream,
    listener: TestRunnable.RunFinishedListener
): TestRunnable

Constructs a TestRunnable which will ask the instrumentation to list out its tests.

Parameters
context: Context

A context

secret: String

A string representing the speakeasy binder key

arguments: Bundle

contains arguments to be passed to the target instrumentation

outputStream: OutputStream

the stream to write the results of the test process

listener: TestRunnable.RunFinishedListener

a callback listener to know when the run has completed