Skip to main content
Flow tests are multi-step integration tests that exercise a complete gameplay sequence across multiple server ticks. They are the closest thing to “playing through a scenario” that you can automate in HRTK.

What Is a Flow Test?

A flow test simulates a sequence of game events and verifies the outcome at each stage. For example:
  1. Spawn an entity in the world
  2. Wait for ECS processors to initialize it
  3. Apply damage to trigger combat logic
  4. Wait for the entity to die
  5. Verify loot drops
Each step may require one or more server ticks to take effect. Flow tests use waitTicks() and awaitCondition() to synchronize with the server’s tick loop.

@FlowTest

The @FlowTest annotation is a shorthand for @HytaleTest + @Tag("flow") with built-in world context and tick timeout:
ParameterDefaultDescription
world""World name (empty = test world)
timeoutTicks200Max ticks before timeout (~6.7 seconds at 30 TPS)

Why Tick Waiting Matters

Hytale’s game loop runs in discrete ticks. When you call ctx.spawnEntity(), the entity is created but not fully set up yet. Components like health, stats, position, and effects are added by the game loop on the following ticks. Without tick waiting:
With tick waiting:

Flow Test Structure

A well-structured flow test follows this pattern:
Use awaitCondition() instead of fixed waitTicks() when you do not know exactly how many ticks an action will take. It polls every tick and returns as soon as the condition is met, making your tests both faster and more reliable.

Isolation for Flow Tests

Flow tests almost always mutate world state. Use IsolationStrategy.DEDICATED_WORLD:

Next Steps

Spawn-Kill-Loot Flow

A complete flow example: spawn, tier, kill, and verify loot drops.

Writing Custom Flows

How to structure your own multi-step flow tests.