UnitTestOptions

Options for controlling unit tests execution.

Properties

PropertyDescription
returnDefaultValues

Whether unmocked methods from android.jar should throw exceptions or return default values (i.e. zero or null).

Methods

MethodDescription
all(configClosure)

Configures all unit testing tasks.

Script blocks

No script blocks

Property details

boolean returnDefaultValues

Whether unmocked methods from android.jar should throw exceptions or return default values (i.e. zero or null).

See Unit testing support for details.

Method details

void all(Closure<Test> configClosure)

Configures all unit testing tasks.

See Test for available options.

Inside the closure you can check the name of the task to configure only some test tasks, e.g.

android {
    testOptions {
        unitTests.all {
            if (it.name == 'testDebug') {
                systemProperty 'debug', 'true'
            }
        }
    }
}