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

TestRunnable

public 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 methods

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

Constructs a TestRunnable executes all tests in arguments.

@NonNull void
run()
static @NonNull TestRunnable
singleTestRunnable(
    @NonNull Context context,
    @NonNull String secret,
    @NonNull Bundle arguments,
    @NonNull OutputStream outputStream,
    @NonNull TestRunnable.RunFinishedListener listener,
    @NonNull String test
)

Constructs a TestRunnable which will run a single test.

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

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

Public methods

legacyTestRunnable

@NonNull
public static TestRunnable legacyTestRunnable(
    @NonNull Context context,
    @NonNull String secret,
    @NonNull Bundle arguments,
    @NonNull OutputStream outputStream,
    @NonNull TestRunnable.RunFinishedListener listener
)

Constructs a TestRunnable executes all tests in arguments.

Parameters
@NonNull Context context

A context

@NonNull String secret

A string representing the speakeasy binder key

@NonNull Bundle arguments

contains arguments to be passed to the target instrumentation

@NonNull OutputStream outputStream

the stream to write the results of the test process

@NonNull TestRunnable.RunFinishedListener listener

a callback listener to know when the run has completed

run

@NonNull
public void run()

singleTestRunnable

@NonNull
public static TestRunnable singleTestRunnable(
    @NonNull Context context,
    @NonNull String secret,
    @NonNull Bundle arguments,
    @NonNull OutputStream outputStream,
    @NonNull TestRunnable.RunFinishedListener listener,
    @NonNull String test
)

Constructs a TestRunnable which will run a single test.

Parameters
@NonNull Context context

A context

@NonNull String secret

A string representing the speakeasy binder key

@NonNull Bundle arguments

contains arguments to be passed to the target instrumentation

@NonNull OutputStream outputStream

the stream to write the results of the test process

@NonNull TestRunnable.RunFinishedListener listener

a callback listener to know when the run has completed

@NonNull String test

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

testCollectionRunnable

@NonNull
public static TestRunnable testCollectionRunnable(
    @NonNull Context context,
    @NonNull String secret,
    @NonNull Bundle arguments,
    @NonNull OutputStream outputStream,
    @NonNull TestRunnable.RunFinishedListener listener
)

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

Parameters
@NonNull Context context

A context

@NonNull String secret

A string representing the speakeasy binder key

@NonNull Bundle arguments

contains arguments to be passed to the target instrumentation

@NonNull OutputStream outputStream

the stream to write the results of the test process

@NonNull TestRunnable.RunFinishedListener listener

a callback listener to know when the run has completed