gradle
8.3

# onOutput

open fun onOutput(closure: Closure)

Adds a closure to be notified when output from the test received. A TestDescriptor and TestOutputEvent instance are passed to the closure as a parameter.

    apply plugin: 'java'

    test {
       onOutput { descriptor, event ->
           if (event.destination == TestOutputEvent.Destination.StdErr) {
               logger.error("Test: " + descriptor + ", error: " + event.message)
           }
       }
    }

Content copied to clipboard

#### Parameters

closure

The closure to call.