Test Features
Minecraft 1.21.5 (Snapshot 25w03a) introduced a major overhaul to the GameTest framework - an automated end-to-end testing system for datapack functionality. Kore provides comprehensive support using a type-safe Kotlin DSL that generates JSON files for the test_instance
and test_environment
registries.
Test Environments
Test environments define preconditions and context for automated test execution.
Creating Test Environments
Environment Types
Combined Environments
Combine multiple conditions using allOf
:
Function Environment
Execute setup and teardown functions:
Game Rules Environment
Create controlled testing conditions:
Time Environment
Ensure consistent timing:
Weather Environment
Control weather conditions:
Test Instances
Test instances define automated tests with structures and execution parameters.
Test Types
- Block-Based: Use test blocks (Start, Log, Fail, Accept) with redstone logic
- Function-Based: Use programmatic function control
Basic Examples
Advanced Configuration
Using Predefined Structures
Test Commands
Test Selectors
Command Examples
Test Execution
Manual Commands
Complete Example
Best Practices
- Combine environments with
allOf
for complex scenarios - Mark critical tests as
required = true
- Set appropriate timeouts with
maxTicks
- Use controlled conditions with game rules for predictable results
- Use predefined structures from
Structures
constants
API Reference
Test Environment Functions
Test Instance Functions
Game Rules Configuration
This DSL provides a type-safe way to create automated tests for Minecraft datapacks using the GameTest framework introduced in snapshot 25w03a.