Basic Flow Structure
Every flow test follows the same fundamental pattern:IsolationStrategy.DEDICATED_WORLD.
Template
Design Patterns
Linear flow (A -> B -> C)
Linear flow (A -> B -> C)
The simplest flow: each step depends on the previous one, executed sequentially.
Branching flow (if condition -> path A, else -> path B)
Branching flow (if condition -> path A, else -> path B)
Some flows need to handle different outcomes depending on server behavior.
Multi-entity flow
Multi-entity flow
Test interactions between multiple entities.
Timed flow (verify something happens within N ticks)
Timed flow (verify something happens within N ticks)
Use
awaitCondition to verify time-bounded behavior.Best Practices
Use descriptive logging
Callctx.log() at each major step. When a flow fails, the logs help you identify exactly where things went wrong.
Prefer awaitCondition over fixed waitTicks
Fixed tick waits are fragile - they may be too short on slow servers or unnecessarily long on fast ones.awaitCondition adapts automatically.
Use @Order for dependent flows
If flow tests in the same suite depend on each other (not recommended, but sometimes necessary), use@Order to enforce execution sequence.
Set appropriate timeoutTicks
Calculate the maximum expected duration of your flow and add a safety margin. At 30 TPS:- 100 ticks = ~3.3 seconds
- 200 ticks = 10 seconds
- 600 ticks = 30 seconds
Next Steps
- Flow: Spawn-Kill-Loot - complete worked example
- Async & Tick Waiting - tick-waiting primitives
- Isolation: DEDICATED_WORLD - world isolation details