@@ -636,10 +636,14 @@ test execution lifecycle. Consult the following sections for examples and the Ja
636
636
each of these interfaces in the `{extension-api-package}` package for further details.
637
637
638
638
* `{BeforeAllCallback}`
639
- ** `{BeforeEachCallback}`
640
- *** `{BeforeTestExecutionCallback}`
641
- *** `{AfterTestExecutionCallback}`
642
- ** `{AfterEachCallback}`
639
+ ** `{BeforeContainerTemplateInvocationCallback}` (only applicable for
640
+ <<writing-tests-container-templates, container templates>>)
641
+ *** `{BeforeEachCallback}`
642
+ **** `{BeforeTestExecutionCallback}`
643
+ **** `{AfterTestExecutionCallback}`
644
+ *** `{AfterEachCallback}`
645
+ ** `{AfterContainerTemplateInvocationCallback}` (only applicable for
646
+ <<writing-tests-container-templates, container templates>>)
643
647
* `{AfterAllCallback}`
644
648
645
649
.Implementing Multiple Extension APIs
@@ -1010,81 +1014,48 @@ image::extensions_lifecycle.png[caption='',title='{figure-caption}']
1010
1014
The following table further explains the sixteen steps in the
1011
1015
<<extensions-execution-order-diagram>> diagram.
1012
1016
1013
- [cols="5,15,80"]
1014
- |===
1015
- | Step | Interface/Annotation | Description
1016
-
1017
- | 1
1018
- | interface `org.junit.jupiter.api.extension.BeforeAllCallback`
1019
- | extension code executed before all tests of the container are executed
1020
-
1021
- | 2
1022
- | annotation `org.junit.jupiter.api.BeforeAll`
1023
- | user code executed before all tests of the container are executed
1024
-
1025
- | 3
1026
- | interface `org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1027
- #handleBeforeAllMethodExecutionException`
1028
- | extension code for handling exceptions thrown from `@BeforeAll` methods
1029
-
1030
- | 4
1031
- | interface `org.junit.jupiter.api.extension.BeforeEachCallback`
1032
- | extension code executed before each test is executed
1033
-
1034
- | 5
1035
- | annotation `org.junit.jupiter.api.BeforeEach`
1036
- | user code executed before each test is executed
1037
-
1038
- | 6
1039
- | interface `org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1040
- #handleBeforeEachMethodExecutionException`
1041
- | extension code for handling exceptions thrown from `@BeforeEach` methods
1042
-
1043
- | 7
1044
- | interface `org.junit.jupiter.api.extension.BeforeTestExecutionCallback`
1045
- | extension code executed immediately before a test is executed
1046
-
1047
- | 8
1048
- | annotation `org.junit.jupiter.api.Test`
1049
- | user code of the actual test method
1050
-
1051
- | 9
1052
- | interface `org.junit.jupiter.api.extension.TestExecutionExceptionHandler`
1053
- | extension code for handling exceptions thrown during a test
1054
-
1055
- | 10
1056
- | interface `org.junit.jupiter.api.extension.AfterTestExecutionCallback`
1057
- | extension code executed immediately after test execution and its corresponding exception handlers
1058
-
1059
- | 11
1060
- | annotation `org.junit.jupiter.api.AfterEach`
1061
- | user code executed after each test is executed
1062
-
1063
- | 12
1064
- | interface `org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1065
- #handleAfterEachMethodExecutionException`
1066
- | extension code for handling exceptions thrown from `@AfterEach` methods
1067
-
1068
- | 13
1069
- | interface `org.junit.jupiter.api.extension.AfterEachCallback`
1070
- | extension code executed after each test is executed
1071
-
1072
- | 14
1073
- | annotation `org.junit.jupiter.api.AfterAll`
1074
- | user code executed after all tests of the container are executed
1075
-
1076
- | 15
1077
- | interface `org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1078
- #handleAfterAllMethodExecutionException`
1079
- | extension code for handling exceptions thrown from `@AfterAll` methods
1080
-
1081
- | 16
1082
- | interface `org.junit.jupiter.api.extension.AfterAllCallback`
1083
- | extension code executed after all tests of the container are executed
1084
-
1085
- |===
1086
-
1087
- In the simplest case only the actual test method will be executed (step 8); all other
1017
+ . *interface* `*org.junit.jupiter.api.extension.BeforeAllCallback*` +
1018
+ extension code executed before all tests of the container are executed
1019
+ . *annotation* `*org.junit.jupiter.api.BeforeAll*` +
1020
+ user code executed before all tests of the container are executed
1021
+ . *interface* `*org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1022
+ #handleBeforeAllMethodExecutionException*` +
1023
+ extension code for handling exceptions thrown from `@BeforeAll` methods
1024
+ . *interface* `*org.junit.jupiter.api.extension.BeforeContainerTemplateInvocationCallback*` +
1025
+ extension code executed before each container template invocation is executed (only applicable if the test class is a <<writing-tests-container-templates, container template>>)
1026
+ . *interface* `*org.junit.jupiter.api.extension.BeforeEachCallback*` +
1027
+ extension code executed before each test is executed
1028
+ . *annotation* `*org.junit.jupiter.api.BeforeEach*` +
1029
+ user code executed before each test is executed
1030
+ . *interface* `*org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1031
+ #handleBeforeEachMethodExecutionException*` +
1032
+ extension code for handling exceptions thrown from `@BeforeEach` methods
1033
+ . *interface* `*org.junit.jupiter.api.extension.BeforeTestExecutionCallback*` +
1034
+ extension code executed immediately before a test is executed
1035
+ . *annotation* `*org.junit.jupiter.api.Test*` +
1036
+ user code of the actual test method
1037
+ . *interface* `*org.junit.jupiter.api.extension.TestExecutionExceptionHandler*` +
1038
+ extension code for handling exceptions thrown during a test
1039
+ . *interface* `*org.junit.jupiter.api.extension.AfterTestExecutionCallback*` +
1040
+ extension code executed immediately after test execution and its corresponding exception handlers
1041
+ . *annotation* `*org.junit.jupiter.api.AfterEach*` +
1042
+ user code executed after each test is executed
1043
+ . *interface* `*org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1044
+ #handleAfterEachMethodExecutionException*` +
1045
+ extension code for handling exceptions thrown from `@AfterEach` methods
1046
+ . *interface* `*org.junit.jupiter.api.extension.AfterEachCallback*` +
1047
+ extension code executed after each test is executed
1048
+ . *interface* `*org.junit.jupiter.api.extension.AfterContainerTemplateInvocationCallback*` +
1049
+ extension code executed after each container template invocation is executed (only applicable if the test class is a <<writing-tests-container-templates, container template>>)
1050
+ . *annotation* `*org.junit.jupiter.api.AfterAll*` +
1051
+ user code executed after all tests of the container are executed
1052
+ . *interface* `*org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
1053
+ #handleAfterAllMethodExecutionException*` +
1054
+ extension code for handling exceptions thrown from `@AfterAll` methods
1055
+ . *interface* `*org.junit.jupiter.api.extension.AfterAllCallback*` +
1056
+ extension code executed after all tests of the container are executed
1057
+
1058
+ In the simplest case only the actual test method will be executed (step 9); all other
1088
1059
steps are optional depending on the presence of user code or extension support for the
1089
1060
corresponding lifecycle callback. For further details on the various lifecycle callbacks
1090
1061
please consult the respective Javadoc for each annotation and extension.
@@ -1097,6 +1068,7 @@ by implementing <<extensions-intercepting-invocations, `InvocationInterceptor`>>
1097
1068
1098
1069
JUnit Jupiter always guarantees _wrapping_ behavior for multiple registered extensions
1099
1070
that implement lifecycle callbacks such as `BeforeAllCallback`, `AfterAllCallback`,
1071
+ `BeforeContainerTemplateInvocationCallback`, `AfterContainerTemplateInvocationCallback`,
1100
1072
`BeforeEachCallback`, `AfterEachCallback`, `BeforeTestExecutionCallback`, and
1101
1073
`AfterTestExecutionCallback`.
1102
1074
0 commit comments