DynamicTest
is a test case generated at runtime.
It is composed of a display name
and an Executable
.
Instances of DynamicTest
must be generated by factory methods
annotated with @TestFactory
.
Note that dynamic tests are quite different from standard @Test
cases since callbacks such as @BeforeEach
and
@AfterEach
methods are not executed for dynamic tests.
dynamicTest(String, Executable)
, stream(Iterator, Function, ThrowingConsumer)
, Test
, TestFactory
, DynamicContainer
, Executable
Modifier and Type | Field and Description |
---|---|
private final Executable |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static DynamicTest | dynamicTest(String
the display name for the dynamic test; never
displayName, Executable null or blankthe executable code block for the dynamic test;
never executable)null Factory for creating a new |
public static DynamicTest | dynamicTest(String
the display name for the dynamic test; never
displayName, URI null or blanka custom test source URI for the dynamic test; may
be testSourceUri, Executable null if the framework should generate the test source based on
the @TestFactory methodthe executable code block for the dynamic test;
never executable)null Factory for creating a new |
public Executable | |
public static < the type of input generated by the T> StreaminputGenerator
and used by the displayNameGenerator and testExecutor | Returns: a stream of dynamic tests based on the given generator and executor; nevernull an inputGenerator, Function<? super T, String> Iterator that serves as a dynamic
input generator; never null a function that generates a display name
based on an input value; never displayNameGenerator, ThrowingConsumer<? super T> null a consumer that executes a test based on an input
value; never testExecutor)null Generate a stream of dynamic tests based on the given generator and test executor. |
public static < the type of input supplied by the T> StreaminputStream
and used by the displayNameGenerator and testExecutor | Returns: a stream of dynamic tests based on the given generator and executor; nevernull a inputStream, Function<? super T, String> Stream that supplies dynamic input values;
never null a function that generates a display name
based on an input value; never displayNameGenerator, ThrowingConsumer<? super T> null a consumer that executes a test based on an input
value; never testExecutor)null Generate a stream of dynamic tests based on the given input stream and test executor. |
public static < the type of input generated by the T> StreaminputGenerator
and used by the testExecutor | Returns: a stream of dynamic tests based on the given generator and executor; nevernull an inputGenerator, ThrowingConsumer<? super T> Iterator with Named values
that serves as a dynamic input generator; never null a consumer that executes a test based on an input
value; never testExecutor)null Generate a stream of dynamic tests based on the given generator and test executor. |
public static < the type of input supplied by the T> StreaminputStream
and used by the displayNameGenerator and testExecutor | Returns: a stream of dynamic tests based on the given generator and executor; nevernull a inputStream, ThrowingConsumer<? super T> Stream that supplies dynamic Named
input values; never null a consumer that executes a test based on an input
value; never testExecutor)null Generate a stream of dynamic tests based on the given input stream and test executor. |
executable | back to summary |
---|---|
private final Executable executable |
DynamicTest | back to summary |
---|---|
private DynamicTest(String displayName, URI testSourceUri, Executable executable) |
dynamicTest | back to summary |
---|---|
public static DynamicTest dynamicTest(String displayName, Executable executable) Factory for creating a new
|
dynamicTest | back to summary |
---|---|
public static DynamicTest dynamicTest(String displayName, URI testSourceUri, Executable executable) Factory for creating a new
|
getExecutable | back to summary |
---|---|
public Executable getExecutable() Get the |
stream | back to summary |
---|---|
public static <T> Stream Generate a stream of dynamic tests based on the given generator and test executor. Use this method when the set of dynamic tests is nondeterministic in
nature or when the input comes from an existing The given
|
stream | back to summary |
---|---|
public static <T> Stream Generate a stream of dynamic tests based on the given input stream and test executor. Use this method when the set of dynamic tests is nondeterministic in
nature or when the input comes from an existing The given
|
stream | back to summary |
---|---|
public static <T> Stream Generate a stream of dynamic tests based on the given generator and test executor. Use this method when the set of dynamic tests is nondeterministic in
nature or when the input comes from an existing The given
|
stream | back to summary |
---|---|
public static <T> Stream Generate a stream of dynamic tests based on the given input stream and test executor. Use this method when the set of dynamic tests is nondeterministic in
nature or when the input comes from an existing The given
|