October 2017
Intermediate to advanced
350 pages
7h 29m
English
A @TestTemplate method is not a regular test case but a template for test cases. Method annotated like this will be invoked multiple times, depending on the invocation context returned by the registered providers. Thus, test templates are used together with a registered TestTemplateInvocationContextProvider extension.
Let see a simple example of a test template. In the following snippet, we can see a method annotated with @TestTemplate, and also declaring an extension of the type MyTestTemplateInvocationContextProvider:
package io.github.bonigarcia;import org.junit.jupiter.api.TestTemplate;import org.junit.jupiter.api.extension.ExtendWith;class TemplateTest { @TestTemplate @ExtendWith(MyTestTemplateInvocationContextProvider. ...Read now
Unlock full access