Entity names like
Kweebec and item names used in examples below are from Hytale’s default content. Replace them with your mod’s actual entity roles and item identifiers.Why Tick Waiting Matters
Consider this naive test:waitTicks()
Pauses the test until the specified number of world ticks have passed. Available on bothEcsTestContext and WorldTestContext.
waitTicks() pauses the test thread while the world keeps ticking normally. Your test resumes automatically once the requested number of ticks have passed.Async variant
If you need non-blocking tick waiting (for concurrent operations), usewaitTicksAsync():
awaitCondition()
Polls a condition every tick until it returns a non-null value, or times out after a maximum number of ticks. This is the preferred way to wait for something to happen without hardcoding tick counts.With custom failure message
@AsyncTest
Marks a test as asynchronous. Methods with@AsyncTest are discovered and run automatically, just like @HytaleTest. The runner will wait up to timeoutTicks server ticks for the test to complete. If specified, timeoutTicks overrides the default timeout for that test.
Common Patterns
Spawn and verify
Spawn and verify
Apply effect and wait
Apply effect and wait
Wait for loot drop
Wait for loot drop
Next Steps
- Flow Tests - multi-step integration tests using tick waiting
- World Surface - world context and block/entity operations
- ECS Surface - ECS assertions and entity queries