Workflow & Assertion Commands Reference

Workflow and assertion commands are framework-level primitives for controlling test flow, managing state, and validating results. These commands cannot be accomplished with normal Minecraft commands.

Overview

Pilaf provides primitive commands for testing framework operations:

  • Control Flow: Wait, health checks

  • State Management: Store, compare, and analyze test state

  • Data Extraction: JSONPath queries and data filtering

  • Validation: Comprehensive assertion types for all test scenarios

Framework Primitives vs. Minecraft Commands

These are framework-level primitives that cannot be done with Minecraft commands: - WAIT - System-level wait, not a game command - STORE_STATE / COMPARE_STATES - Framework state management - ASSERT_* - Test validation primitives

For game operations, use SERVER_COMMAND or PLAYER_COMMAND with Minecraft syntax.

Command Categories

Category Purpose

Workflow Commands

Control test execution and manage state

Assertion Commands

Validate expected outcomes and conditions


Workflow Commands

WAIT

Pause test execution for a specified duration. Essential for waiting for server responses, entity spawns, or any asynchronous operation.

Syntax

- action: "WAIT"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  duration: 5000                    (3)
1 Step ID for output referencing (optional)
2 Descriptive name for logging (optional)
3 Duration in milliseconds (required)

Parameters

Parameter Type Required Description

action

string

Yes

Must be "WAIT"

id

string

No

Step identifier for output referencing

name

string

No

Human-readable description

duration

number

Yes

Pause duration in milliseconds

Outputs

Output Type Description

result

string

Status message (e.g., "Waited for 5000ms")

status

string

"success" if wait completed

duration

number

Actual duration waited in milliseconds

Time Reference

Value Description

1000

1 second

5000

5 seconds

60000

1 minute

300000

5 minutes

600000

10 minutes

Example

# Wait for server startup
- action: "CHECK_SERVICE_HEALTH"
  id: "health_check"
  name: "Check server health"

# Wait 5 seconds for server to be ready
- action: "WAIT"
  name: "Wait for server startup"
  duration: 5000

# Wait for player connection
- action: "CONNECT_PLAYER"
  name: "Connect test player"
  player: "pilaf_tester"

# Wait for entity spawn
- action: "SERVER_COMMAND"
  id: "spawn_zombie"
  name: "Spawn zombie"
  command: "summon zombie ~ ~ ~ {CustomName:'\"test_zombie\"'}"

- action: "WAIT"
  name: "Wait for entity to spawn"
  duration: 2000

STORE_STATE

Store the result of an action for later comparison or reference. Essential for state comparison tests where you capture a "before" state and compare it with an "after" state.

Syntax

- action: "STORE_STATE"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  sourceVariable: "${{ steps.step_id.outputs.result }}"  (3)
  variableName: "my_state"          (4)
1 Step ID for this store operation
2 Descriptive name (optional)
3 Reference to the source variable/step output
4 Name to store the state under (required)

Parameters

Parameter Type Required Description

action

string

Yes

Must be "STORE_STATE"

id

string

No

Step identifier

name

string

No

Human-readable description

sourceVariable

string

Yes

Reference to the value to store (e.g., ${{ steps.step_id.outputs.result }})

variableName

string

Yes

Name to identify this stored state

Outputs

Output Type Description

result

string

Confirmation message

storedValue

string

The value that was stored

variableName

string

The variable name used

status

string

"success" if stored successfully

Example

# Capture initial world time
- action: "SERVER_COMMAND"
  id: "initial_time"
  name: "Get initial time"
  command: "time query gametime"

- action: "STORE_STATE"
  id: "store_start_time"
  name: "Store initial time"
  sourceVariable: "${{ steps.initial_time.outputs.result }}"
  variableName: "start_time"

# Perform actions that change time
- action: "SERVER_COMMAND"
  name: "Set time to noon"
  command: "time set noon"

# Capture final world time
- action: "SERVER_COMMAND"
  id: "final_time"
  name: "Get final time"
  command: "time query gametime"

- action: "STORE_STATE"
  id: "store_end_time"
  name: "Store final time"
  sourceVariable: "${{ steps.final_time.outputs.result }}"
  variableName: "end_time"

# Compare states
- action: "COMPARE_STATES"
  name: "Compare time states"
  state1: "start_time"
  state2: "end_time"

Print the value of a stored state to the test output. Useful for debugging and logging state values during test execution.

Syntax

- action: "PRINT_STORED_STATE"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  variableName: "my_state"          (3)
1 Step ID (optional)
2 Descriptive name (optional)
3 Name of the stored state to print

Parameters

Parameter Type Required Description

action

string

Yes

Must be "PRINT_STORED_STATE"

id

string

No

Step identifier

name

string

No

Human-readable description

variableName

string

Yes

Name of the stored state to print

Outputs

Output Type Description

result

string

The stored value

variableName

string

The variable name

status

string

"success" if found

Example

# Store some state
- action: "SERVER_COMMAND"
  id: "server_info"
  name: "Get server info"
  command: "version"

- action: "EXTRACT_WITH_JSONPATH"
  id: "extract_version"
  name: "Extract server version"
  sourceVariable: "${{ steps.server_info.outputs.result }}"
  jsonPath: "$"
  storeAs: "server_version"

# Print the stored state
- action: "PRINT_STORED_STATE"
  id: "print_version"
  name: "Print server version"
  variableName: "server_version"

COMPARE_STATES

Compare two stored states and return the differences. Essential for state comparison tests that verify changes between "before" and "after" snapshots.

Syntax

- action: "COMPARE_STATES"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  state1: "state_variable_name"     (3)
  state2: "state_variable_name"     (4)
1 Step ID for output referencing
2 Descriptive name (optional)
3 First state to compare (from variableName)
4 Second state to compare

Parameters

Parameter Type Required Description

action

string

Yes

Must be "COMPARE_STATES"

id

string

No

Step identifier

name

string

No

Human-readable description

state1

string

Yes

Name of first stored state

state2

string

Yes

Name of second stored state

Outputs

Output Type Description

result

json

JSON object with comparison details

equal

boolean

true if states are equal

state1_name

string

Name of first state

state2_name

string

Name of second state

added

array

New elements in state2

removed

array

Elements removed from state1

changed

array

Elements that changed

message

string

Human-readable comparison summary

Example

# Capture inventory before action
- action: "SERVER_COMMAND"
  id: "inventory_before"
  name: "Get inventory before"
  command: "data get entity pilaf_tester Inventory"

- action: "STORE_STATE"
  id: "store_before"
  name: "Store before state"
  sourceVariable: "${{ steps.inventory_before.outputs.result }}"
  variableName: "inventory_before"

# Give player an item
- action: "SERVER_COMMAND"
  name: "Give diamond"
  command: "give pilaf_tester diamond"

# Capture inventory after action
- action: "SERVER_COMMAND"
  id: "inventory_after"
  name: "Get inventory after"
  command: "data get entity pilaf_tester Inventory"

- action: "STORE_STATE"
  id: "store_after"
  name: "Store after state"
  sourceVariable: "${{ steps.inventory_after.outputs.result }}"
  variableName: "inventory_after"

# Compare states
- action: "COMPARE_STATES"
  id: "compare_inventory"
  name: "Compare inventory states"
  state1: "inventory_before"
  state2: "inventory_after"

Print the result of a state comparison in a human-readable format. Useful for debugging and logging comparison results.

Syntax

- action: "PRINT_STATE_COMPARISON"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  fromComparison: "${{ steps.compare_states.outputs.result }}"  (3)
1 Step ID (optional)
2 Descriptive name (optional)
3 Reference to comparison result

Parameters

Parameter Type Required Description

action

string

Yes

Must be "PRINT_STATE_COMPARISON"

id

string

No

Step identifier

name

string

No

Human-readable description

fromComparison

string

Yes

Reference to comparison result (e.g., ${{ steps.compare_id.outputs.result }})

Outputs

Output Type Description

result

string

Formatted comparison output

equal

boolean

Whether states are equal

summary

string

Brief summary of differences

status

string

"success" if printed

Example

# Compare states and print result
- action: "COMPARE_STATES"
  id: "compare"
  name: "Compare inventory"
  state1: "inventory_before"
  state2: "inventory_after"

- action: "PRINT_STATE_COMPARISON"
  id: "print_result"
  name: "Print comparison result"
  fromComparison: "${{ steps.compare.outputs.result }}"

EXTRACT_WITH_JSONPATH

Extract specific values from JSON data using JSONPath expressions. Essential for accessing nested data in server responses and command outputs.

Syntax

- action: "EXTRACT_WITH_JSONPATH"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  sourceVariable: "${{ steps.step_id.outputs.result }}"  (3)
  jsonPath: "$.path.to.value"       (4)
  storeAs: "variable_name"          (5)
1 Step ID for output referencing
2 Descriptive name (optional)
3 Reference to source JSON data
4 JSONPath expression to extract
5 Variable name to store extracted value

Parameters

Parameter Type Required Description

action

string

Yes

Must be "EXTRACT_WITH_JSONPATH"

id

string

No

Step identifier

name

string

No

Human-readable description

sourceVariable

string

Yes

Reference to source JSON data

jsonPath

string

Yes

JSONPath expression

storeAs

string

Yes

Variable name for extracted value

Outputs

Output Type Description

result

string

Extracted value

extractedValue

string

The extracted value

jsonPath

string

The JSONPath used

status

string

"success" if extracted

JSONPath Examples

Expression Description

$.x

Extract x coordinate from position

$.y

Extract y coordinate from position

$.z

Extract z coordinate from position

$.items[0]

Extract first item from array

$.items[0].name

Extract name of first item

$.entities[0].uuid

Extract UUID of first entity

$.version

Extract version field

$..health

Recursively find health fields

Example

# Get server info
- action: "SERVER_COMMAND"
  id: "server_info"
  name: "Get server info"
  command: "version"

# Extract version
- action: "EXTRACT_WITH_JSONPATH"
  id: "extract_version"
  name: "Extract version"
  sourceVariable: "${{ steps.server_info.outputs.result }}"
  jsonPath: "$"
  storeAs: "server_version"

# Get player position and extract coordinates
- action: "PLAYER_COMMAND"
  id: "player_pos"
  name: "Get player position"
  player: "pilaf_tester"
  command: "data get entity @s Pos"

- action: "EXTRACT_WITH_JSONPATH"
  id: "extract_x"
  name: "Extract X coordinate"
  sourceVariable: "${{ steps.player_pos.outputs.result }}"
  jsonPath: "$"
  storeAs: "player_x"

FILTER_ENTITIES

Filter entities based on specified criteria such as type, name, or custom properties. Useful for finding specific entities among many.

Syntax

- action: "FILTER_ENTITIES"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  sourceVariable: "${{ steps.get_entities.outputs.result }}"  (3)
  filterType: "type"                (4)
  filterValue: "zombie"             (5)
1 Step ID for output referencing
2 Descriptive name (optional)
3 Reference to the source entities data
4 Filter type: type, name, customName
5 Value to filter by

Parameters

Parameter Type Required Description

action

string

Yes

Must be "FILTER_ENTITIES"

id

string

No

Step identifier

name

string

No

Human-readable description

sourceVariable

string

Yes

Reference to entities JSON data

filterType

string

Yes

Filter criterion: type, name, customName, uuid

filterValue

string

Yes

Value to match

Outputs

Output Type Description

result

json

JSON array of matching entities

count

number

Number of matching entities

entities

array

Array of entity objects

status

string

"success" if filtered

Example

# Get all entities using selector
- action: "SERVER_COMMAND"
  id: "get_all"
  name: "Get all entities"
  command: "execute as @a run data get entity @e"

# Filter zombies (post-processing)
- action: "FILTER_ENTITIES"
  id: "filter_zombies"
  name: "Filter zombie entities"
  sourceVariable: "${{ steps.get_all.outputs.result }}"
  filterType: "type"
  filterValue: "zombie"

EXECUTE_PLAYER_COMMAND

Execute a command as a connected player through the Mineflayer client. This simulates a player typing a command in chat, which is useful for testing commands that only work when executed by a player.

Syntax

- action: "EXECUTE_PLAYER_COMMAND"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  player: "player_name"             (3)
  command: "/home set"              (4)
1 Step ID for output referencing
2 Descriptive name (optional)
3 Player name to execute as
4 Command to execute (with or without /)

Parameters

Parameter Type Required Description

action

string

Yes

Must be "EXECUTE_PLAYER_COMMAND"

id

string

No

Step identifier

name

string

No

Human-readable description

player

string

Yes

Player name to execute command

command

string

Yes

Command to execute

Outputs

Output Type Description

result

string

Command response

status

string

"success" or "failure"

message

string

Human-readable status message

player

string

Player who executed

Example

# Connect player first
- action: "CONNECT_PLAYER"
  name: "Connect test player"
  player: "pilaf_tester"

# Execute player command
- action: "EXECUTE_PLAYER_COMMAND"
  id: "set_home"
  name: "Set home location"
  player: "pilaf_tester"
  command: "/home set"

# Execute home teleport
- action: "EXECUTE_PLAYER_COMMAND"
  id: "go_home"
  name: "Teleport to home"
  player: "pilaf_tester"
  command: "/home"

# Execute plugin command
- action: "EXECUTE_PLAYER_COMMAND"
  id: "plugin_cmd"
  name: "Execute plugin command"
  player: "pilaf_tester"
  command: "/myplugin action"

EXECUTE_PLAYER_RAW

Execute a raw command as a player without any processing. Provides direct access to the player’s command channel.

Syntax

- action: "EXECUTE_PLAYER_RAW"
  id: "unique_step_id"              (1)
  name: "Human-readable name"       (2)
  player: "player_name"             (3)
  command: "raw_command_string"     (4)
1 Step ID for output referencing
2 Descriptive name (optional)
3 Player name to execute as
4 Raw command string to send

Parameters

Parameter Type Required Description

action

string

Yes

Must be "EXECUTE_PLAYER_RAW"

id

string

No

Step identifier

name

string

No

Human-readable description

player

string

Yes

Player name to execute command

command

string

Yes

Raw command string

Outputs

Output Type Description

result

string

Raw response from server

status

string

"success" or "failure"

message

string

Status message

Example

# Connect player
- action: "CONNECT_PLAYER"
  name: "Connect player"
  player: "pilaf_tester"

# Send raw command with NBT data
- action: "EXECUTE_PLAYER_RAW"
  id: "give_sword"
  name: "Give enchanted sword"
  player: "pilaf_tester"
  command: "give pilaf_tester diamond_sword 1 {ench:[{id:0,lvl:5}]}"

Unlike EXECUTE_PLAYER_COMMAND, this sends the command exactly as provided without any preprocessing or argument parsing.



Assertion Commands

Assertion commands validate expected outcomes and ensure test reliability.

ASSERT_ENTITY_EXISTS

Assert that a specific entity exists in the Minecraft world. The entity is identified by its custom name (without the test_ prefix).

Syntax

- action: "ASSERT_ENTITY_EXISTS"
  name: "Human-readable name"       (1)
  entity: "entity_name"             (2)
  expected: true                    (3)
1 Descriptive name for the assertion
2 Entity name to check (without test_ prefix)
3 Expected existence (optional, default: true)

Parameters

Parameter Type Required Description

action

string

Yes

Must be "ASSERT_ENTITY_EXISTS"

name

string

No

Human-readable description

entity

string

Yes

Entity name to check

expected

boolean

No

Expected existence (default: true)

Result

Field Type Description

passed

boolean

true if entity exists as expected

message

string

Summary message

details

string

Entity existence status

Example

# Spawn entity
- action: "SERVER_COMMAND"
  name: "Spawn zombie"
  command: "summon zombie ~ ~ ~ {CustomName:'\"test_zombie\"'}"

# Assert entity exists
- action: "ASSERT_ENTITY_EXISTS"
  name: "Verify zombie spawned"
  entity: "zombie"

ASSERT_ENTITY_MISSING

Assert that a specific entity does not exist in the Minecraft world. The entity is identified by its custom name (with or without the test_ prefix).

Syntax

- action: "ASSERT_ENTITY_MISSING"
  name: "Human-readable name"       (1)
  entity: "entity_name"             (2)
1 Descriptive name for the assertion
2 Entity name to check

Parameters

Parameter Type Required Description

action

string

Yes

Must be "ASSERT_ENTITY_MISSING"

name

string

No

Human-readable description

entity

string

Yes

Entity name to check

Result

Field Type Description

passed

boolean

true if entity does not exist

message

string

Summary message

details

string

Entity existence status

Example

# Assert entity doesn't exist yet
- action: "ASSERT_ENTITY_MISSING"
  name: "Verify no zombie yet"
  entity: "zombie"

# Kill entity
- action: "SERVER_COMMAND"
  name: "Kill zombie"
  command: "kill @e[type=zombie,custom_name=test_zombie]"

# Assert entity is gone
- action: "ASSERT_ENTITY_MISSING"
  name: "Verify zombie gone"
  entity: "zombie"

ASSERT_RESPONSE_CONTAINS

Assert that a response string contains expected content. This is a framework-level primitive for validating command outputs.

Syntax

- action: "ASSERT_RESPONSE_CONTAINS"
  name: "Human-readable name"       (1)
  source: "${{ steps.step_id.outputs.result }}"  (2)
  contains: "expected_text"          (3)
1 Descriptive name (optional)
2 Reference to the response to check
3 Expected text that must be present

Parameters

Parameter Type Required Description

action

string

Yes

Must be "ASSERT_RESPONSE_CONTAINS"

name

string

No

Human-readable description

source

string

Yes

Reference to response data

contains

string

Yes

Expected content

Result

Field Type Description

passed

boolean

true if assertion passed

message

string

Summary message

details

string

Assertion details

Example

# Execute server command
- action: "SERVER_COMMAND"
  id: "version_cmd"
  name: "Get server version"
  command: "version"

# Assert response contains expected text
- action: "ASSERT_RESPONSE_CONTAINS"
  name: "Verify version response"
  source: "${{ steps.version_cmd.outputs.result }}"
  contains: "version"

ASSERT_JSON_EQUALS

Assert that a JSON response matches an expected structure. This framework primitive validates complex data structures.

Syntax

- action: "ASSERT_JSON_EQUALS"
  name: "Human-readable name"       (1)
  source: "${{ steps.step_id.outputs.result }}"  (2)
  expected: '{"key": "value"}'      (3)
1 Descriptive name (optional)
2 Reference to JSON response
3 Expected JSON structure

Parameters

Parameter Type Required Description

action

string

Yes

Must be "ASSERT_JSON_EQUALS"

name

string

No

Human-readable description

source

string

Yes

Reference to JSON data

expected

string

Yes

Expected JSON structure

Result

Field Type Description

passed

boolean

true if JSON matches

message

string

Summary message

details

string

Comparison details

Example

# Get server version as JSON
- action: "SERVER_COMMAND"
  id: "version_cmd"
  name: "Get version JSON"
  command: "data get entity @e[type=player,limit=1]"

# Assert JSON structure
- action: "ASSERT_JSON_EQUALS"
  name: "Verify player data structure"
  source: "${{ steps.version_cmd.outputs.result }}"
  expected: '{"id": "test_player"}'

ASSERT_LOG_CONTAINS

Assert that the server logs contain a specific pattern. This is a framework-level primitive for verifying server behavior through log analysis.

Syntax

- action: "ASSERT_LOG_CONTAINS"
  name: "Human-readable name"       (1)
  pattern: "expected_log_pattern"    (2)
1 Descriptive name (optional)
2 Regular expression pattern to match

Parameters

Parameter Type Required Description

action

string

Yes

Must be "ASSERT_LOG_CONTAINS"

name

string

No

Human-readable description

pattern

string

Yes

Regex pattern to search in logs

Result

Field Type Description

passed

boolean

true if pattern found

message

string

Summary message

details

string

Match details

Example

# Spawn entity
- action: "SERVER_COMMAND"
  name: "Spawn zombie"
  command: "summon zombie ~ ~ ~ {CustomName:'\"test_zombie\"'}"

# Assert log contains spawn message
- action: "ASSERT_LOG_CONTAINS"
  name: "Verify spawn logged"
  pattern: "Summoned.*Zombie"

ASSERT_CONDITION

Assert that a custom condition evaluates to true. This is a generic framework primitive for flexible validation logic.

Syntax

- action: "ASSERT_CONDITION"
  name: "Human-readable name"       (1)
  condition: "${{ variable }} == expected"  (2)
1 Descriptive name (optional)
2 Condition expression to evaluate

Parameters

Parameter Type Required Description

action

string

Yes

Must be "ASSERT_CONDITION"

name

string

No

Human-readable description

condition

string

Yes

Condition to evaluate

Result

Field Type Description

passed

boolean

true if condition is true

message

string

Summary message

details

string

Condition evaluation result

Example

# Store count
- action: "SERVER_COMMAND"
  id: "count_cmd"
  name: "Count entities"
  command: "execute if entity @e[type=zombie]"

# Assert condition on result
- action: "ASSERT_CONDITION"
  name: "Verify zombie count"
  condition: "${{ steps.count_cmd.outputs.result }} != 0"

Command Summary

Command Purpose Key Outputs

WAIT

Pause test execution

duration, status

STORE_STATE

Store state for later use

variableName, storedValue

COMPARE_STATES

Compare two stored states

equal, added, removed

EXTRACT_WITH_JSONPATH

Extract values from JSON

result, extractedValue

FILTER_ENTITIES

Filter entities by criteria

count, entities

EXECUTE_PLAYER_COMMAND

Execute command as player

result, status

EXECUTE_PLAYER_RAW

Execute raw player command

result, status

ASSERT_ENTITY_EXISTS

Assert entity exists

passed, details

ASSERT_ENTITY_MISSING

Assert entity does not exist

passed, details

ASSERT_RESPONSE_CONTAINS

Assert response content

passed, details

ASSERT_JSON_EQUALS

Assert JSON structure

passed, details

ASSERT_LOG_CONTAINS

Assert log pattern

passed, details

ASSERT_CONDITION

Assert custom condition

passed, details


See Also


Back to top

Copyright © 2025 Pilaf Contributors. Open source under the MIT license.

This site uses Just the Docs, a documentation theme for Jekyll.