Skip to content

Test Format Overview

Flint tests are JSON files with a defined structure. This page explains the basic layout.

{
"flintVersion": "0.1.0",
"name": "Test Name",
"description": "Optional description",
"tags": ["unit", "redstone"],
"dependencies": [],
"setup": {
"cleanup": {
"region": [[0, 0, 0], [14, 10, 14]]
},
"player": { ... }
},
"timeline": [ ... ],
"breakpoints": [5, 10]
}
FieldTypeDescription
namestringName of the test (shown in output)
setupobjectTest configuration with cleanup region
timelinearrayList of actions
FieldTypeDefaultDescription
flintVersionstring-Flint version for compatibility
descriptionstring-Detailed description
tagsstring[]["default"]Tags for filtering
dependenciesstring[][]Tests that must run first
breakpointsnumber[][]Ticks for debug pause

The setup section configures the test environment.

{
"setup": {
"cleanup": {
"region": [[minX, minY, minZ], [maxX, maxY, maxZ]]
}
}
}

Constraints:

  • Maximum width (X): 15 blocks
  • Maximum height (Y): 384 blocks
  • Maximum depth (Z): 15 blocks
  • All positions in the timeline must be within this region
{
"setup": {
"cleanup": { "region": [[0,0,0], [5,5,5]] },
"player": {
"inventory": {
"hotbar1": { "item": "minecraft:diamond_axe", "count": 1 },
"hotbar2": { "item": "minecraft:honeycomb", "count": 64 },
"off_hand": { "item": "minecraft:shield", "count": 1 }
},
"selectedHotbar": 1
}
}
}

Available Slots:

SlotDescription
hotbar1 - hotbar9Hotbar slots
off_handOff-hand
helmetHelmet
chestplateChestplate
leggingsLeggings
bootsBoots

The timeline is an array of actions executed at specific ticks.

{
"timeline": [
{ "at": 0, "do": "place", ... },
{ "at": 5, "do": "assert", ... }
]
}

Actions can execute at one or multiple ticks:

// Single tick
{ "at": 5, "do": "place", ... }
// Multiple ticks (action repeats)
{ "at": [0, 5, 10], "do": "assert", ... }

Blocks can be defined with properties in two formats:

{
"id": "minecraft:lever",
"powered": false,
"face": "floor",
"facing": "north"
}
{
"id": "minecraft:lever",
"properties": {
"powered": "false",
"face": "floor",
"facing": "north"
}
}

Both formats produce the same block state:

minecraft:lever[powered=false,face=floor,facing=north]
  • Strings: "north", "side", "floor"
  • Booleans: true, false
  • Numbers: 15, 0

Tags enable filtering and grouping of tests.

{
"tags": ["redstone", "unit", "fast"]
}

Tests without tags are automatically assigned to the default tag.

TagUsage
unitSingle behavior tests
integrationMulti-system tests
regressionTests for fixed bugs
slowTests with many ticks
redstoneRedstone mechanics
pistonPiston behavior

Flint automatically validates tests when loading:

  1. Setup present - setup.cleanup.region must exist
  2. Region valid - min ≤ max for all coordinates
  3. Dimensions check - Region not larger than allowed
  4. Positions check - All timeline positions within region

Errors are reported with file, line, and column:

tests/my-test.json:15:8: Position [20,0,0] is outside cleanup region