The Three Strategies
| Strategy | Protects | Cost | Best For |
|---|---|---|---|
NONE | Nothing | Zero overhead | Read-only tests, pure logic, assertions |
SNAPSHOT | ECS store state | Snapshot + restore per suite | Component mutation tests |
DEDICATED_WORLD | Full world state | World create + destroy per suite | Block, spawn, and integration tests |
Decision Flowchart
Side-by-Side Comparison
NONE
No protection. Tests see and modify live server state. Suite instantiation is the only boundary. Fast but risky for mutating tests.
SNAPSHOT
ECS state is captured before the suite and restored after. Components modified during tests are reverted. Blocks and spawned entities are NOT rolled back.
DEDICATED_WORLD
A temporary void world is created for the suite. All entities, blocks, and state are destroyed when the suite completes. Full isolation at the cost of world creation overhead.
Usage
Set the isolation strategy on@HytaleSuite:
When to Use Each
NONE: Read-only and logic tests
NONE: Read-only and logic tests
Use
NONE when your tests:- Only read data, never write
- Test pure functions or utility classes
- Test codec round-trips (no server state involved)
- Verify annotations, configuration, or metadata
SNAPSHOT: Component mutation tests
SNAPSHOT: Component mutation tests
Use
SNAPSHOT when your tests:- Create entities and attach/remove components
- Modify stat values or entity state
- Need to revert changes after the suite without destroying the world
DEDICATED_WORLD: Block and spawn tests
DEDICATED_WORLD: Block and spawn tests
Use
DEDICATED_WORLD when your tests:- Place or break blocks
- Spawn and kill entities
- Need a clean, predictable world state
- Test multi-step flows (spawn -> modify -> verify -> cleanup)
Next Steps
- Isolation: NONE — detailed guide
- Isolation: SNAPSHOT — detailed guide
- Isolation: DEDICATED_WORLD — detailed guide