|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2023 the original author or authors. |
| 2 | + * Copyright 2002-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
171 | 171 | enum ExecutionPhase {
|
172 | 172 |
|
173 | 173 | /**
|
174 |
| - * The configured SQL scripts and statements will be executed |
175 |
| - * once per test class <em>before</em> any test method is run. |
| 174 | + * The configured SQL scripts and statements will be executed once per |
| 175 | + * test class <em>before</em> any test method is run. |
| 176 | + * <p>Specifically, the configured SQL scripts and statements will be |
| 177 | + * executed prior to any <em>before class lifecycle methods</em> of a |
| 178 | + * particular testing framework — for example, methods annotated |
| 179 | + * with JUnit Jupiter's {@link org.junit.jupiter.api.BeforeAll @BeforeAll} |
| 180 | + * annotation. |
| 181 | + * <p>NOTE: Configuring {@code BEFORE_TEST_CLASS} as the execution phase |
| 182 | + * causes the test's {@code ApplicationContext} to be eagerly loaded |
| 183 | + * during test class initialization which can potentially result in |
| 184 | + * undesired side effects. For example, |
| 185 | + * {@link org.springframework.test.context.DynamicPropertySource @DynamicPropertySource} |
| 186 | + * methods will be invoked before {@code @BeforeAll} methods when using |
| 187 | + * {@code BEFORE_TEST_CLASS}. |
176 | 188 | * @since 6.1
|
| 189 | + * @see #AFTER_TEST_CLASS |
| 190 | + * @see #BEFORE_TEST_METHOD |
| 191 | + * @see #AFTER_TEST_METHOD |
177 | 192 | */
|
178 | 193 | BEFORE_TEST_CLASS,
|
179 | 194 |
|
180 | 195 | /**
|
181 |
| - * The configured SQL scripts and statements will be executed |
182 |
| - * once per test class <em>after</em> all test methods have run. |
| 196 | + * The configured SQL scripts and statements will be executed once per |
| 197 | + * test class <em>after</em> all test methods have run. |
| 198 | + * <p>Specifically, the configured SQL scripts and statements will be |
| 199 | + * executed after any <em>after class lifecycle methods</em> of a |
| 200 | + * particular testing framework — for example, methods annotated |
| 201 | + * with JUnit Jupiter's {@link org.junit.jupiter.api.AfterAll @AfterAll} |
| 202 | + * annotation. |
183 | 203 | * @since 6.1
|
| 204 | + * @see #BEFORE_TEST_CLASS |
| 205 | + * @see #BEFORE_TEST_METHOD |
| 206 | + * @see #AFTER_TEST_METHOD |
184 | 207 | */
|
185 | 208 | AFTER_TEST_CLASS,
|
186 | 209 |
|
187 | 210 | /**
|
188 | 211 | * The configured SQL scripts and statements will be executed
|
189 | 212 | * <em>before</em> the corresponding test method.
|
| 213 | + * <p>Specifically, the configured SQL scripts and statements will be |
| 214 | + * executed prior to any <em>before test lifecycle methods</em> of a |
| 215 | + * particular testing framework — for example, methods annotated |
| 216 | + * with JUnit Jupiter's {@link org.junit.jupiter.api.BeforeEach @BeforeEach} |
| 217 | + * annotation. |
| 218 | + * @see #BEFORE_TEST_CLASS |
| 219 | + * @see #AFTER_TEST_CLASS |
| 220 | + * @see #AFTER_TEST_METHOD |
190 | 221 | */
|
191 | 222 | BEFORE_TEST_METHOD,
|
192 | 223 |
|
193 | 224 | /**
|
194 | 225 | * The configured SQL scripts and statements will be executed
|
195 | 226 | * <em>after</em> the corresponding test method.
|
| 227 | + * <p>Specifically, the configured SQL scripts and statements will be |
| 228 | + * executed after any <em>after test lifecycle methods</em> of a |
| 229 | + * particular testing framework — for example, methods annotated |
| 230 | + * with JUnit Jupiter's {@link org.junit.jupiter.api.AfterEach @AfterEach} |
| 231 | + * annotation. |
| 232 | + * @see #BEFORE_TEST_CLASS |
| 233 | + * @see #AFTER_TEST_CLASS |
| 234 | + * @see #BEFORE_TEST_METHOD |
196 | 235 | */
|
197 | 236 | AFTER_TEST_METHOD
|
198 | 237 | }
|
|
0 commit comments