Package rife.bld.extension.testing
Class EnabledOnCiCondition
java.lang.Object
rife.bld.extension.testing.EnabledOnCiCondition
- All Implemented Interfaces:
ExecutionCondition
,Extension
Implementation of JUnit's
ExecutionCondition
to conditionally enable tests when running in a CI/CD
environment.
This condition determines whether a test or test container should be enabled or disabled based on the presence of
the CI
environment variable. If the variable is set, the condition enables the test; otherwise, it disables
the test.
The presence of the CI
environment variable is typically an indicator that the code is running in a CI/CD
pipeline, as this variable is automatically defined in most CI environments such as GitHub Actions, GitLab CI, and
others.
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluates whether the execution of a test should be enabled or disabled based on the CI environment.
-
Constructor Details
-
EnabledOnCiCondition
public EnabledOnCiCondition()
-
-
Method Details
-
evaluateExecutionCondition
Evaluates whether the execution of a test should be enabled or disabled based on the CI environment.Returns an enabled state if the test is running in a CI/CD environment, otherwise returns a disabled state.
- Specified by:
evaluateExecutionCondition
in interfaceExecutionCondition
- Parameters:
context
- theExtensionContext
for the current test or container- Returns:
- a
ConditionEvaluationResult
indicating whether the test is enabled or disabled
-