The ExecutionCondition
extension allows us to implement conditional execution of the test based on certain test characteristics.
There are different conditional execution annotations available in Jupiter. However, we have much more freedom to implement different conditions to run the tests using the extensions.
We have to create a class that extends the ExecutionCondition
interface. This allows us to write an extension that accesses the conditional execution extension point.
Example
The code below is an example of RunOnCIEnvironmentExtension
. It runs the test only on continuous integration (CI) environments like Jenkins.
Get hands-on with 1200+ tech skills courses.