Interface TestReporter
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface @API(status=STABLE, since="5.0") public interface TestReporterParameters of typeTestReportercan be injected into@BeforeEachand@AfterEachlifecycle methods as well as methods annotated with@Test,@RepeatedTest,@ParameterizedTest,@TestFactory, etc.Within such methods the injected
TestReportercan be used to publish report entries for the current container or test to the reporting infrastructure.- Since:
- 5.0
- See Also:
publishEntry(Map),publishEntry(String, String)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default voidpublishDirectory(java.lang.String name, ThrowingConsumer<java.nio.file.Path> action)Publish a directory with the supplied name written by the supplied action and attach it to the current test or container.default voidpublishDirectory(java.nio.file.Path directory)Publish the supplied directory and attach it to the current test or container.default voidpublishEntry(java.lang.String value)Publish the supplied value as a report entry.default voidpublishEntry(java.lang.String key, java.lang.String value)Publish the supplied key-value pair as a report entry.voidpublishEntry(java.util.Map<java.lang.String,java.lang.String> map)Publish the supplied map of key-value pairs as a report entry.default voidpublishFile(java.lang.String name, MediaType mediaType, ThrowingConsumer<java.nio.file.Path> action)Deprecated.UsepublishFile(String, MediaType, ThrowingConsumer)instead.default voidpublishFile(java.lang.String name, MediaType mediaType, ThrowingConsumer<java.nio.file.Path> action)Publish a file with the supplied name and media type written by the supplied action and attach it to the current test or container.default voidpublishFile(java.nio.file.Path file, MediaType mediaType)Deprecated.UsepublishFile(Path, MediaType)instead.default voidpublishFile(java.nio.file.Path file, MediaType mediaType)Publish the supplied file and attach it to the current test or container.
-
-
-
Method Detail
-
publishEntry
void publishEntry(java.util.Map<java.lang.String,java.lang.String> map)
Publish the supplied map of key-value pairs as a report entry.- Parameters:
map- the key-value pairs to be published; nevernull; keys and values within entries in the map also must not benullor blank- See Also:
publishEntry(String, String),publishEntry(String)
-
publishEntry
default void publishEntry(java.lang.String key, java.lang.String value)Publish the supplied key-value pair as a report entry.- Parameters:
key- the key of the entry to publish; nevernullor blankvalue- the value of the entry to publish; nevernullor blank- See Also:
publishEntry(Map),publishEntry(String)
-
publishEntry
@API(status=STABLE, since="5.3") default void publishEntry(java.lang.String value)Publish the supplied value as a report entry.This method delegates to
publishEntry(String, String), supplying"value"as the key and the suppliedvalueargument as the value.- Parameters:
value- the value to be published; nevernullor blank- Since:
- 5.3
- See Also:
publishEntry(Map),publishEntry(String, String)
-
publishFile
@Deprecated @API(status=DEPRECATED, since="5.14") default void publishFile(java.nio.file.Path file, MediaType mediaType)Deprecated.UsepublishFile(Path, MediaType)instead.Publish the supplied file and attach it to the current test or container.The file will be copied to the report output directory replacing any potentially existing file with the same name.
- Parameters:
file- the file to be published; nevernullmediaType- the media type of the file; nevernull; useMediaType.APPLICATION_OCTET_STREAMif unknown- Since:
- 5.12
-
publishFile
@API(status=MAINTAINED, since="5.14") default void publishFile(java.nio.file.Path file, MediaType mediaType)Publish the supplied file and attach it to the current test or container.The file will be copied to the report output directory replacing any potentially existing file with the same name.
- Parameters:
file- the file to be published; nevernullmediaType- the media type of the file; nevernull; useMediaType.APPLICATION_OCTET_STREAMif unknown- Since:
- 5.14
-
publishDirectory
@API(status=MAINTAINED, since="5.13.3") default void publishDirectory(java.nio.file.Path directory)Publish the supplied directory and attach it to the current test or container.The entire directory will be copied to the report output directory replacing any potentially existing files with the same name.
- Parameters:
directory- the directory to be published; nevernull- Since:
- 5.12
-
publishFile
@Deprecated @API(status=DEPRECATED, since="5.14") default void publishFile(java.lang.String name, MediaType mediaType, ThrowingConsumer<java.nio.file.Path> action)Deprecated.UsepublishFile(String, MediaType, ThrowingConsumer)instead.Publish a file with the supplied name and media type written by the supplied action and attach it to the current test or container.The
Pathpassed to the supplied action will be relative to the report output directory, but it is up to the action to write the file.- Parameters:
name- the name of the file to be published; nevernullor blank and must not contain any path separatorsmediaType- the media type of the file; nevernull; useMediaType.APPLICATION_OCTET_STREAMif unknownaction- the action to be executed to write the file; nevernull- Since:
- 5.12
-
publishFile
@API(status=MAINTAINED, since="5.14") default void publishFile(java.lang.String name, MediaType mediaType, ThrowingConsumer<java.nio.file.Path> action)Publish a file with the supplied name and media type written by the supplied action and attach it to the current test or container.The
Pathpassed to the supplied action will be relative to the report output directory, but it is up to the action to write the file.- Parameters:
name- the name of the file to be published; nevernullor blank and must not contain any path separatorsmediaType- the media type of the file; nevernull; useMediaType.APPLICATION_OCTET_STREAMif unknownaction- the action to be executed to write the file; nevernull- Since:
- 5.14
-
publishDirectory
@API(status=MAINTAINED, since="5.13.3") default void publishDirectory(java.lang.String name, ThrowingConsumer<java.nio.file.Path> action)Publish a directory with the supplied name written by the supplied action and attach it to the current test or container.The
Pathpassed to the supplied action will be relative to the report output directory and will point to an existing directory, but it is up to the action to write files to the directory.- Parameters:
name- the name of the directory to be published; nevernullor blank and must not contain any path separatorsaction- the action to be executed to write to the directory; nevernull- Since:
- 5.12
-
-