1.2.5.3 有条件的测试执行
ExecutionCondition
defines the Extension
API for programmatic, conditional test execution.
An ExecutionCondition
is evaluated for each container (e.g., a test class) to determine if all the tests it contains should be executed based on the supplied ExtensionContext
. Similarly, an ExecutionCondition
is evaluated for each test to determine if a given test method should be executed based on the supplied ExtensionContext
.
When multiple ExecutionCondition
extensions are registered, a container or test is disabled as soon as one of the conditions returns disabled. Thus, there is no guarantee that a condition is evaluated because another extension might have already caused a container or test to be disabled. In other words, the evaluation works like the short-circuiting boolean OR operator.
See the source code of DisabledCondition
and @Disabled
for concrete examples.