TestLoggingContainer
public interface TestLogging
Modifier and Type | Method | Description |
---|---|---|
void |
events(java.lang.Object... events) |
Sets the events to be logged.
|
int |
getDisplayGranularity() |
Returns the display granularity of the events to be logged.
|
java.util.Set<TestLogEvent> |
getEvents() |
Returns the events to be logged.
|
TestExceptionFormat |
getExceptionFormat() |
Returns the format to be used for logging test exceptions.
|
int |
getMaxGranularity() |
Returns the maximum granularity of the events to be logged.
|
int |
getMinGranularity() |
Returns the minimum granularity of the events to be logged.
|
boolean |
getShowCauses() |
Tells whether causes of exceptions that occur during test execution will be logged.
|
boolean |
getShowExceptions() |
Tells whether exceptions that occur during test execution will be logged.
|
boolean |
getShowStackTraces() |
Tells whether stack traces of exceptions that occur during test execution will be logged.
|
boolean |
getShowStandardStreams() |
Tells whether output on standard out and standard error will be logged.
|
java.util.Set<TestStackTraceFilter> |
getStackTraceFilters() |
Returns the set of filters to be used for sanitizing test stack traces.
|
void |
setDisplayGranularity(int granularity) |
Sets the display granularity of the events to be logged.
|
void |
setEvents(java.lang.Iterable<?> events) |
Sets the events to be logged.
|
void |
setEvents(java.util.Set<TestLogEvent> events) |
Sets the events to be logged.
|
void |
setExceptionFormat(java.lang.Object exceptionFormat) |
Sets the format to be used for logging test exceptions.
|
void |
setExceptionFormat(TestExceptionFormat exceptionFormat) |
Sets the format to be used for logging test exceptions.
|
void |
setMaxGranularity(int granularity) |
Returns the maximum granularity of the events to be logged.
|
void |
setMinGranularity(int granularity) |
Sets the minimum granularity of the events to be logged.
|
void |
setShowCauses(boolean flag) |
Sets whether causes of exceptions that occur during test execution will be logged.
|
void |
setShowExceptions(boolean flag) |
Sets whether exceptions that occur during test execution will be logged.
|
void |
setShowStackTraces(boolean flag) |
Sets whether stack traces of exceptions that occur during test execution will be logged.
|
TestLogging |
setShowStandardStreams(boolean flag) |
Sets whether output on standard out and standard error will be logged.
|
void |
setStackTraceFilters(java.lang.Iterable<?> stackTraces) |
Sets the set of filters to be used for sanitizing test stack traces.
|
void |
setStackTraceFilters(java.util.Set<TestStackTraceFilter> stackTraces) |
Sets the set of filters to be used for sanitizing test stack traces.
|
void |
stackTraceFilters(java.lang.Object... stackTraces) |
Convenience method for
setStackTraceFilters(java.lang.Iterable) . |
java.util.Set<TestLogEvent> getEvents()
void setEvents(java.util.Set<TestLogEvent> events)
events
- the events to be loggedvoid setEvents(java.lang.Iterable<?> events)
events
- the events to be loggedvoid events(java.lang.Object... events)
TestLogEvent.FAILED
) or Strings (e.g. "failed").events
- the events to be loggedint getMinGranularity()
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.
void setMinGranularity(int granularity)
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.
granularity
- the minimum granularity of the events to be loggedint getMaxGranularity()
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.
void setMaxGranularity(int granularity)
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.
granularity
- the maximum granularity of the events to be loggedint getDisplayGranularity()
-1 denotes the highest granularity and corresponds to an atomic test.
void setDisplayGranularity(int granularity)
-1 denotes the highest granularity and corresponds to an atomic test.
granularity
- the display granularity of the events to be loggedboolean getShowExceptions()
void setShowExceptions(boolean flag)
flag
- whether exceptions that occur during test execution will be loggedboolean getShowCauses()
showExceptions
is true
. Defaults to true.void setShowCauses(boolean flag)
showExceptions
is true
. Defaults to true.flag
- whether causes of exceptions that occur during test execution will be loggedboolean getShowStackTraces()
void setShowStackTraces(boolean flag)
flag
- whether stack traces of exceptions that occur during test execution will be loggedTestExceptionFormat getExceptionFormat()
showStackTraces
is true
. Defaults to TestExceptionFormat.FULL
for
the INFO and DEBUG log levels and TestExceptionFormat.SHORT
for the LIFECYCLE log level.void setExceptionFormat(TestExceptionFormat exceptionFormat)
showStackTraces
is true
. Defaults to TestExceptionFormat.FULL
for
the INFO and DEBUG log levels and TestExceptionFormat.SHORT
for the LIFECYCLE log level.exceptionFormat
- the format to be used for logging test exceptionsvoid setExceptionFormat(java.lang.Object exceptionFormat)
showStackTraces
is true
. Defaults to TestExceptionFormat.FULL
for
the INFO and DEBUG log levels and TestExceptionFormat.SHORT
for the LIFECYCLE log level.exceptionFormat
- the format to be used for logging test exceptionsjava.util.Set<TestStackTraceFilter> getStackTraceFilters()
void setStackTraceFilters(java.util.Set<TestStackTraceFilter> stackTraces)
stackTraces
- the set of filters to be used for sanitizing test stack tracesvoid setStackTraceFilters(java.lang.Iterable<?> stackTraces)
stackTraces
- the set of filters to be used for sanitizing test stack tracesvoid stackTraceFilters(java.lang.Object... stackTraces)
setStackTraceFilters(java.lang.Iterable)
. Accepts both enum values and Strings.boolean getShowStandardStreams()
TestLogEvent.STANDARD_OUT
and TestLogEvent.STANDARD_ERROR
are
set.TestLogging setShowStandardStreams(boolean flag)
TestLogEvent.STANDARD_OUT
and TestLogEvent.STANDARD_ERROR
.