Skip to main content
Version: 6.2.3 (Unmaintained)

Named Builders

Each composite action class provides a public static method named after the action that returns its Builder. Terminal action classes provide named static factory methods that return the action directly. Import statically for concise action tree definitions.

import static org.paramixel.api.action.Scope.scope;
import static org.paramixel.api.action.Sequential.sequential;
import static org.paramixel.api.action.Parallel.parallel;
import static org.paramixel.api.action.Step.step;
import static org.paramixel.api.action.Delay.delay;
import static org.paramixel.api.action.Delay.delayRandom;

Terminal actions (named factory methods)​

Terminal actions return the action directly rather than a builder:

ActionFactoryDescription
Stepstep(name, consumer)Terminal action wrapping user logic.
Delaydelay(name, long)Fixed-duration pause in milliseconds.
Delaydelay(name, Duration)Fixed-duration pause.
DelaydelayRandom(name, long, long)Random-duration pause between bounds.
AssertassertThat(name, expected, actual)Boolean assertion.
AssertassertThat(name, expected, actual, message)Boolean assertion with failure message.
AssertassertThat(name, expected, supplier)Lazy boolean assertion.
AssertassertThat(name, expected, supplier, message)Lazy boolean assertion with failure message.
AssertassertTrue(name, actual)Shorthand for assertThat(name, true, actual).
AssertassertTrue(name, supplier)Shorthand for assertThat(name, true, supplier).
AssertassertFalse(name, actual)Shorthand for assertThat(name, false, actual).
AssertassertFalse(name, supplier)Shorthand for assertThat(name, false, supplier).

Composite actions (named builder methods)​

ActionFactoryBuilder methods
Scopescope(name)before, body, after
Sequentialsequential(name)child, dependent/independent, shuffle
Parallelparallel(name)child, parallelism, shuffle
Repeatrepeat(name)body, iterations
Conditionalconditional(name, condition)body
Instanceinstance(name, factory) / instance(type) / instance(name, type)body
Isolatedisolated(name, lockName)body
Timeouttimeout(name)body, timeout/timeoutMillis
Untiluntil(name)body, maxIterations, until

Usage example​

import static org.paramixel.api.action.Scope.scope;
import static org.paramixel.api.action.Sequential.sequential;
import static org.paramixel.api.action.Parallel.parallel;
import static org.paramixel.api.action.Assert.assertTrue;
import static org.paramixel.api.action.Step.step;
import static org.paramixel.api.action.Delay.delay;

Action tree = scope("root")
.body(sequential("suite")
.child(step("login", ctx -> doLogin()))
.child(parallel("verify")
.child(step("ui", ctx -> checkUi()))
.child(step("api", ctx -> checkApi()))
.build())
.child(assertTrue("verified", true))
.build())
.body(delay("think-time", 200))
.build();

See also​

  • Action — the sealed interface and its subtypes
  • Builder — mutable builders that produce immutable action snapshots