TestLoggingContainer

API Documentation:TestLoggingContainer

Note: This class is incubating and may change in a future version of Gradle.

Container for all test logging related options. Different options can be set for each log level. Options that are set directly (without specifying a log level) apply to log level LIFECYCLE. Example:

apply plugin: 'java'

test {
    testLogging {
        // set options for log level LIFECYCLE
        events "failed"
        exceptionFormat "short"
        // set options for log level DEBUG
        debug {
            events "started", "skipped", "failed"
            exceptionFormat "full"
        }
    }
}

The defaults that are in place show progressively more information on log levels LIFECYCLE, INFO, and DEBUG, respectively.

Properties

PropertyDescription
debug
Incubating

Returns logging options for debug level.

displayGranularity
Incubating

The display granularity of the events to be logged. For example, if set to 0, a method-level event will be displayed as "Test Run > Test Worker x > org.SomeClass > org.someMethod". If set to 2, the same event will be displayed as "org.someClass > org.someMethod".

error
Incubating

Returns logging options for error level.

events
Incubating

The events to be logged.

exceptionFormat
Incubating

The format to be used for logging test exceptions. Only relevant if showStackTraces is true.

info
Incubating

Gets logging options for info level.

lifecycle
Incubating

Returns logging options for lifecycle level.

maxGranularity
Incubating

The maximum granularity of the events to be logged. Typically, 0 corresponds to the Gradle-generated test suite for the whole test run, 1 corresponds to the Gradle-generated test suite for a particular test JVM, 2 corresponds to a test class, and 3 corresponds to a test method. These values will vary if user-defined suites are executed.

minGranularity
Incubating

The minimum granularity of the events to be logged. Typically, 0 corresponds to the Gradle-generated test suite for the whole test run, 1 corresponds to the Gradle-generated test suite for a particular test JVM, 2 corresponds to a test class, and 3 corresponds to a test method. These values will vary if user-defined suites are executed.

quiet
Incubating

Returns logging options for quiet level.

showCauses
Incubating

Tells whether causes of exceptions that occur during test execution will be logged. Only relevant if showExceptions is true.

showExceptions
Incubating

Tells whether exceptions that occur during test execution will be logged. Typically these exceptions coincide with a "failed" event.

showStackTraces
Incubating

Tells whether stack traces of exceptions that occur during test execution will be logged.

showStandardStreams

Tells whether output on standard out and standard error will be logged. Equivalent to checking if both log events <UNHANDLED-LINK>TestLogEvent#STANDARD_OUT</UNHANDLED-LINK> and <UNHANDLED-LINK>TestLogEvent#STANDARD_ERROR</UNHANDLED-LINK> are set.

stackTraceFilters
Incubating

The set of filters to be used for sanitizing test stack traces.

warn
Incubating

Gets logging options for warn level.

Property details

Note: This property is incubating and may change in a future version of Gradle.

Returns logging options for debug level.

int displayGranularity

Note: This property is incubating and may change in a future version of Gradle.

The display granularity of the events to be logged. For example, if set to 0, a method-level event will be displayed as "Test Run > Test Worker x > org.SomeClass > org.someMethod". If set to 2, the same event will be displayed as "org.someClass > org.someMethod".

-1 denotes the highest granularity and corresponds to an atomic test.

Note: This property is incubating and may change in a future version of Gradle.

Returns logging options for error level.

Note: This property is incubating and may change in a future version of Gradle.

The events to be logged.

TestExceptionFormat exceptionFormat

Note: This property is incubating and may change in a future version of Gradle.

The format to be used for logging test exceptions. Only relevant if showStackTraces is true.

Note: This property is incubating and may change in a future version of Gradle.

Gets logging options for info level.

TestLogging lifecycle

Note: This property is incubating and may change in a future version of Gradle.

Returns logging options for lifecycle level.

int maxGranularity

Note: This property is incubating and may change in a future version of Gradle.

The maximum granularity of the events to be logged. Typically, 0 corresponds to the Gradle-generated test suite for the whole test run, 1 corresponds to the Gradle-generated test suite for a particular test JVM, 2 corresponds to a test class, and 3 corresponds to a test method. These values will vary if user-defined suites are executed.

-1 denotes the highest granularity and corresponds to an atomic test.

int minGranularity

Note: This property is incubating and may change in a future version of Gradle.

The minimum granularity of the events to be logged. Typically, 0 corresponds to the Gradle-generated test suite for the whole test run, 1 corresponds to the Gradle-generated test suite for a particular test JVM, 2 corresponds to a test class, and 3 corresponds to a test method. These values will vary if user-defined suites are executed.

-1 denotes the highest granularity and corresponds to an atomic test.

Note: This property is incubating and may change in a future version of Gradle.

Returns logging options for quiet level.

boolean showCauses

Note: This property is incubating and may change in a future version of Gradle.

Tells whether causes of exceptions that occur during test execution will be logged. Only relevant if showExceptions is true.

boolean showExceptions

Note: This property is incubating and may change in a future version of Gradle.

Tells whether exceptions that occur during test execution will be logged. Typically these exceptions coincide with a "failed" event.

boolean showStackTraces

Note: This property is incubating and may change in a future version of Gradle.

Tells whether stack traces of exceptions that occur during test execution will be logged.

boolean showStandardStreams

Tells whether output on standard out and standard error will be logged. Equivalent to checking if both log events <UNHANDLED-LINK>TestLogEvent#STANDARD_OUT</UNHANDLED-LINK> and <UNHANDLED-LINK>TestLogEvent#STANDARD_ERROR</UNHANDLED-LINK> are set.

Set<TestStackTraceFilter> stackTraceFilters

Note: This property is incubating and may change in a future version of Gradle.

The set of filters to be used for sanitizing test stack traces.

Note: This property is incubating and may change in a future version of Gradle.

Gets logging options for warn level.

Script blocks

No script blocks

Methods

No methods