TestReporter can be injected into
@BeforeEach and @AfterEach lifecycle
methods as well as methods annotated with @Test,
@RepeatedTest,
@ParameterizedTest,
@TestFactory, etc.
Within such methods the injected TestReporter can be used to
publish report entries for the current container or test to the
reporting infrastructure.
publishEntry(Map), publishEntry(String, String)
| Modifier and Type | Method and Description |
|---|---|
| public default void | publishDirectory(Path
the directory to be published; never directory)nullPublish the supplied directory and attach it to the current test or container. |
| public default void | publishDirectory(String
the name of the directory to be published; never name, ThrowingConsumer<Path> null
or blank and must not contain any path separatorsthe action to be executed to write to the directory; never
action)nullPublish a directory with the supplied name written by the supplied action and attach it to the current test or container. |
| public void | publishEntry(Map<String, String>
the key-value pairs to be published; never map)null;
keys and values within entries in the map also must not be
null or blankPublish the supplied map of key-value pairs as a report entry. |
| public default void | publishEntry(String
the key of the entry to publish; never key, String null or blankthe value of the entry to publish; never value)null or blankPublish the supplied key-value pair as a report entry. |
| public default void | publishEntry(String
the value to be published; never value)null or blankPublish the supplied value as a report entry. |
| public default void | publishFile(Path
the file to be published; never file, MediaType nullthe media type of the file; never mediaType)null; use
org.
if unknown
Deprecated
for removal since 5.14. Use
publishFile(Path, MediaType) instead.
Publish the supplied file and attach it to the current test or container. |
| public default void | publishFile(Path
the file to be published; never file, MediaType nullthe media type of the file; never mediaType)null; use
MediaType#APPLICATION_OCTET_STREAM if unknownPublish the supplied file and attach it to the current test or container. |
| public default void | publishFile(String
the name of the file to be published; never name, MediaType null or
blank and must not contain any path separatorsthe media type of the file; never mediaType, ThrowingConsumer<Path> null; use
org.
if unknownthe action to be executed to write the file; never action)null
Deprecated
for removal since 5.14. Use
publishFile(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. |
| public default void | publishFile(String
the name of the file to be published; never name, MediaType null or
blank and must not contain any path separatorsthe media type of the file; never mediaType, ThrowingConsumer<Path> null; use
MediaType#APPLICATION_OCTET_STREAM if unknownthe action to be executed to write the file; never action)nullPublish a file with the supplied name and media type written by the supplied action and attach it to the current test or container. |
| publishDirectory | back to summary |
|---|---|
| public default void publishDirectory(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.
| |
| publishDirectory | back to summary |
|---|---|
| public default void publishDirectory(String name, ThrowingConsumer<Path> action) Publish a directory with the supplied name written by the supplied action and attach it to the current test or container. The
| |
| publishEntry | back to summary |
|---|---|
| public void publishEntry(Map<String, String> map) Publish the supplied map of key-value pairs as a report entry.
| |
| publishEntry | back to summary |
|---|---|
| public default void publishEntry(String key, String value) Publish the supplied key-value pair as a report entry.
| |
| publishEntry | back to summary |
|---|---|
| public default void publishEntry(String value) Publish the supplied value as a report entry. This method delegates to
| |
| publishFile | back to summary |
|---|---|
| public default void publishFile(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.
| |
| publishFile | back to summary |
|---|---|
| public default void publishFile(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.
| |
| publishFile | back to summary |
|---|---|
| public default void publishFile(String name, MediaType mediaType, ThrowingConsumer<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
| |
| publishFile | back to summary |
|---|---|
| public default void publishFile(String name, MediaType mediaType, ThrowingConsumer<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
| |