Interface TestLogging
- All Known Subinterfaces:
- TestLoggingContainer
- 
Method SummaryModifier and TypeMethodDescriptionvoidSets the events to be logged.intReturns the display granularity of the events to be logged.Returns the events to be logged.Returns the format to be used for logging test exceptions.intReturns the maximum granularity of the events to be logged.intReturns the minimum granularity of the events to be logged.booleanTells whether causes of exceptions that occur during test execution will be logged.booleanTells whether exceptions that occur during test execution will be logged.booleanTells whether stack traces of exceptions that occur during test execution will be logged.booleanTells whether output on standard out and standard error will be logged.Returns the set of filters to be used for sanitizing test stack traces.voidsetDisplayGranularity(int granularity) Sets the display granularity of the events to be logged.voidSets the events to be logged.voidsetEvents(Set<TestLogEvent> events) Sets the events to be logged.voidsetExceptionFormat(Object exceptionFormat) Sets the format to be used for logging test exceptions.voidsetExceptionFormat(TestExceptionFormat exceptionFormat) Sets the format to be used for logging test exceptions.voidsetMaxGranularity(int granularity) Returns the maximum granularity of the events to be logged.voidsetMinGranularity(int granularity) Sets the minimum granularity of the events to be logged.voidsetShowCauses(boolean flag) Sets whether causes of exceptions that occur during test execution will be logged.voidsetShowExceptions(boolean flag) Sets whether exceptions that occur during test execution will be logged.voidsetShowStackTraces(boolean flag) Sets whether stack traces of exceptions that occur during test execution will be logged.setShowStandardStreams(boolean flag) Sets whether output on standard out and standard error will be logged.voidsetStackTraceFilters(Iterable<?> stackTraces) Sets the set of filters to be used for sanitizing test stack traces.voidsetStackTraceFilters(Set<TestStackTraceFilter> stackTraces) Sets the set of filters to be used for sanitizing test stack traces.voidstackTraceFilters(Object... stackTraces) Convenience method forsetStackTraceFilters(java.lang.Iterable).
- 
Method Details- 
getEventsReturns the events to be logged.- Returns:
- the events to be logged
 
- 
setEventsSets the events to be logged.- Parameters:
- events- the events to be logged
- Since:
- 4.0
 
- 
setEventsSets the events to be logged.- Parameters:
- events- the events to be logged
 
- 
eventsSets the events to be logged. Events can be passed as enum values (e.g.TestLogEvent.FAILED) or Strings (e.g. "failed").- Parameters:
- events- the events to be logged
 
- 
getMinGranularityReturns the minimum granularity of the events to be logged. Typically, 0 corresponds to events from 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 may extend higher if user-defined suites or parameterized test methods are executed. Events from levels lower than the specified granularity will be ignored.The default granularity is -1, which specifies that test events from only the most granular level should be logged. In other words, if a test method is not parameterized, only events from the test method will be logged and events from the test class and lower will be ignored. On the other hand, if a test method is parameterized, then events from the iterations of that test method will be logged and events from the test method and lower will be ignored. - Returns:
- the minimum granularity of the events to be logged
 
- 
setMinGranularityvoid setMinGranularity(int granularity) Sets the minimum granularity of the events to be logged. Typically, 0 corresponds to events from 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 may extend higher if user-defined suites or parameterized test methods are executed. Events from levels lower than the specified granularity will be ignored.The default granularity is -1, which specifies that test events from only the most granular level should be logged. In other words, if a test method is not parameterized, only events from the test method will be logged and events from the test class and lower will be ignored. On the other hand, if a test method is parameterized, then events from the iterations of that test method will be logged and events from the test method and lower will be ignored. - Parameters:
- granularity- the minimum granularity of the events to be logged
 
- 
getMaxGranularityReturns 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 may extend higher if user-defined suites or parameterized test methods are executed. Events from levels higher than the specified granularity will be ignored.The default granularity is -1, which specifies that test events from only the most granular level should be logged. Setting this value to something lower will cause events from a higher level to be ignored. For example, setting the value to 3 will cause only events from the test method level to be logged and any events from iterations of a parameterized test method will be ignored. - Returns:
- the maximum granularity of the events to be logged
 
- 
setMaxGranularityvoid setMaxGranularity(int granularity) Returns 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 may extend higher if user-defined suites or parameterized test methods are executed. Events from levels higher than the specified granularity will be ignored.The default granularity is -1, which specifies that test events from only the most granular level should be logged. Setting this value to something lower will cause events from a higher level to be ignored. For example, setting the value to 3 will cause only events from the test method level to be logged and any events from iterations of a parameterized test method will be ignored. Note that since the default value of getMinGranularity()is -1 (the highest level of granularity) it only makes sense to configure the maximum granularity while also setting the minimum granularity to a value greater than -1.- Parameters:
- granularity- the maximum granularity of the events to be logged
 
- 
getDisplayGranularityReturns 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. - Returns:
- the display granularity of the events to be logged
 
- 
setDisplayGranularityvoid setDisplayGranularity(int granularity) Sets 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. - Parameters:
- granularity- the display granularity of the events to be logged
 
- 
getShowExceptionsTells whether exceptions that occur during test execution will be logged. Typically these exceptions coincide with a "failed" event. Defaults to true.- Returns:
- whether exceptions that occur during test execution will be logged
 
- 
setShowExceptionsvoid setShowExceptions(boolean flag) Sets whether exceptions that occur during test execution will be logged. Defaults to true.- Parameters:
- flag- whether exceptions that occur during test execution will be logged
 
- 
getShowCausesTells whether causes of exceptions that occur during test execution will be logged. Only relevant ifshowExceptionsistrue. Defaults to true.- Returns:
- whether causes of exceptions that occur during test execution will be logged
 
- 
setShowCausesvoid setShowCauses(boolean flag) Sets whether causes of exceptions that occur during test execution will be logged. Only relevant ifshowExceptionsistrue. Defaults to true.- Parameters:
- flag- whether causes of exceptions that occur during test execution will be logged
 
- 
getShowStackTracesTells whether stack traces of exceptions that occur during test execution will be logged. Defaults to true.- Returns:
- whether stack traces of exceptions that occur during test execution will be logged
 
- 
setShowStackTracesvoid setShowStackTraces(boolean flag) Sets whether stack traces of exceptions that occur during test execution will be logged. Defaults to true.- Parameters:
- flag- whether stack traces of exceptions that occur during test execution will be logged
 
- 
getExceptionFormatReturns the format to be used for logging test exceptions. Only relevant ifshowStackTracesistrue. Defaults toTestExceptionFormat.FULLfor the INFO and DEBUG log levels andTestExceptionFormat.SHORTfor the LIFECYCLE log level.- Returns:
- the format to be used for logging test exceptions
 
- 
setExceptionFormatSets the format to be used for logging test exceptions. Only relevant ifshowStackTracesistrue. Defaults toTestExceptionFormat.FULLfor the INFO and DEBUG log levels andTestExceptionFormat.SHORTfor the LIFECYCLE log level.- Parameters:
- exceptionFormat- the format to be used for logging test exceptions
- Since:
- 4.0
 
- 
setExceptionFormatSets the format to be used for logging test exceptions. Only relevant ifshowStackTracesistrue. Defaults toTestExceptionFormat.FULLfor the INFO and DEBUG log levels andTestExceptionFormat.SHORTfor the LIFECYCLE log level.- Parameters:
- exceptionFormat- the format to be used for logging test exceptions
 
- 
getStackTraceFiltersReturns the set of filters to be used for sanitizing test stack traces.- Returns:
- the set of filters to be used for sanitizing test stack traces
 
- 
setStackTraceFiltersSets the set of filters to be used for sanitizing test stack traces.- Parameters:
- stackTraces- the set of filters to be used for sanitizing test stack traces
- Since:
- 4.0
 
- 
setStackTraceFiltersSets the set of filters to be used for sanitizing test stack traces.- Parameters:
- stackTraces- the set of filters to be used for sanitizing test stack traces
 
- 
stackTraceFiltersConvenience method forsetStackTraceFilters(java.lang.Iterable). Accepts both enum values and Strings.
- 
getShowStandardStreamsTells whether output on standard out and standard error will be logged. Equivalent to checking if both log eventsTestLogEvent.STANDARD_OUTandTestLogEvent.STANDARD_ERRORare set.
- 
setShowStandardStreamsSets whether output on standard out and standard error will be logged. Equivalent to setting log eventsTestLogEvent.STANDARD_OUTandTestLogEvent.STANDARD_ERROR.
 
-