Skip to main content
Version: 6.0.0 (Unmaintained)

Action

Action is a sealed interface representing an immutable, reusable execution unit processed by a Runner.

public sealed interface Action
permits Assert, Delay, Instance, Parallel, Repeat, Scope, Sequence, Static, Step, Timeout {

String displayName();
}

Design​

An Action defines structure and identity, not execution logic. The runner and scheduler own all descriptor traversal, status transitions, and listener callbacks. Actions carry only their display name; execution behavior is handled by the scheduler interpreting each sealed subtype.

All action subtypes are immutable after construction. For configurable actions, use the corresponding Builder subtype to produce an immutable action snapshot via Builder.build().

Subtypes​

TypeDescription
StepTerminal action wrapping a ContextConsumer.
AssertTerminal action evaluating a boolean condition.
SequenceComposite: executes children sequentially. Dependent/independent modes.
ParallelComposite: executes children concurrently with bounded admission.
ScopeComposite: before-body-after with lifecycle guarantee (after always runs).
StaticComposite: before-body-after without a fixture instance.
InstanceComposite: creates a fixture instance, runs body, destroys instance.
DelayTerminal: pauses for a duration.
RepeatDecorator: executes a child action N times.
TimeoutDecorator: executes a child action with a wall-clock deadline.

Composition​

Build action trees by nesting actions through builders:

import org.paramixel.api.action.Action;
import org.paramixel.api.action.Scope;
import org.paramixel.api.action.Sequence;
import org.paramixel.api.action.Step;

Action test = Scope.builder("browser test")
.before(Step.of("start browser", ctx -> startBrowser()))
.body(Sequence.builder("scenario")
.child(Step.of("open page", ctx -> openPage()))
.child(Step.of("verify", ctx -> verifyPage()))
.build())
.after(Step.of("stop browser", ctx -> stopBrowser()))
.build();

See Builder for the Builder sealed interface and its subtypes.