Built-in Actions and When to Use Them
Action is a sealed interface in org.paramixel.api.action with 13 permitted subtypes. Each action is an immutable, reusable definition. The runner and scheduler own all traversal, execution, status transitions, and listener callbacks.
public sealed interface Action
permits Assert, Conditional, Delay, Instance, Isolated, Parallel, Repeat, Scope, Sequential, Static, Step, Timeout, Until {
String displayName();
}
Built-in actions
Stepwraps aContextConsumerfor user logic.Sequentialruns children one after another in dependent or independent mode, optionally shuffled. In dependent mode (the default), aFAILEDorSKIPPEDchild short-circuits the sequence (remaining children are skipped); anABORTEDchild does not short-circuit, so siblings still run and the sequence aggregates toABORTED. In independent mode, all children run regardless of outcome. See Exception Reference for how each outcome exception affects siblings.Parallelruns children concurrently with configurable parallelism, optionally shuffled.Scopeprovides before-body-after execution with lifecycle guarantee; the after action always runs.Staticprovides before-body-after without a fixture instance. (Deprecated since 6.2 — useScopeinstead.)Instancecreates a fixture instance, runs the body, and destroys it.Assertevaluates a boolean condition against an expected value. Passes when the actual value equals the expected value; fails withFailExceptionotherwise. Created via static factories, not a builder:assertTrue(name, actual),assertFalse(name, actual),assertThat(name, expected, actual),assertThat(name, expected, () -> compute(), "message").Delaypauses execution for a fixed or random duration. Created via static factories:delay(name, millis)ordelay(name, Duration).Isolatedexecutes its body under a named re-entrant lock. Same-named nodes serialize. Nested same-name nodes are re-entrant.Repeatexecutes a child action a configurable number of times.Timeoutexecutes a child action with a wall-clock deadline.Conditionalevaluates a runtime predicate and gates body execution. When the predicate is false, the node reportsPASSEDand the body subtree is skipped. Because the node passes, it does not disrupt dependent siblings inSequential.Untilexecutes a child action repeatedly until aPredicate<Context>returnstrue, the body action passes, ormaxIterationsis exhausted. Individual iteration failures continue the loop. Whenuntil()is configured, onlyABORTEDor predicate satisfaction stops early; exhaustion reportsFAILED. Whenuntil()is absent, the loop stops when the body passes and reportsPASSED.
Choosing an action
| Need | Use |
|---|---|
| Run one piece of user code | Step |
| Check a boolean condition | Assert |
| Run children in order | Sequential |
| Run independent branches concurrently | Parallel |
| Attach setup and teardown to a subtree | Scope (was Static — deprecated since 6.2) |
| Create and use a fixture instance | Instance |
| Serialize access to a shared resource | Isolated |
| Retry or repeat a child | Repeat or Until |
| Bound a child by elapsed time | Timeout |
| Gate a subtree based on runtime state | Conditional |
Composition example
import org.paramixel.api.action.Action;
import static org.paramixel.api.action.Scope.scope;
import static org.paramixel.api.action.Sequential.sequential;
import static org.paramixel.api.action.Step.step;
Action test = scope("browser test")
.before(step("start browser", ctx -> startBrowser()))
.body(sequential("scenario")
.child(step("open page", ctx -> openPage()))
.child(step("verify", ctx -> verifyPage()))
.build())
.after(step("stop browser", ctx -> stopBrowser()))
.build();
browser test
├── before: start browser
├── body: scenario
│ ├── open page
│ └── verify
└── after: stop browser
Use Scope when setup and teardown belong to a specific action tree. Use @Paramixel.BeforeAll and @Paramixel.AfterAll only for runner-wide lifecycle around all discovered factory actions.
Use the corresponding Builder nested class for each action type. See Builder for details.
For a more concise syntax, see the Named Builders reference.