- Workflow & Assertion Commands Reference
- Overview
- Command Categories
- Workflow Commands
- WAIT
- STORE_STATE
- PRINT_STORED_STATE
- COMPARE_STATES
- PRINT_STATE_COMPARISON
- EXTRACT_WITH_JSONPATH
- FILTER_ENTITIES
- EXECUTE_PLAYER_COMMAND
- EXECUTE_PLAYER_RAW
- Assertion Commands
- ASSERT_ENTITY_EXISTS
- ASSERT_ENTITY_MISSING
- ASSERT_RESPONSE_CONTAINS
- ASSERT_JSON_EQUALS
- ASSERT_LOG_CONTAINS
- ASSERT_CONDITION
- Command Summary
- See Also
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:
- For game operations, use |
Command Categories
| Category | Purpose |
|---|---|
Workflow Commands |
Control test execution and manage state |
Assertion Commands |
Validate expected outcomes and conditions |
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier for output referencing |
|
string |
No |
Human-readable description |
|
number |
Yes |
Pause duration in milliseconds |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
Status message (e.g., "Waited for 5000ms") |
|
string |
|
|
number |
Actual duration waited in milliseconds |
Time Reference
| Value | Description |
|---|---|
|
1 second |
|
5 seconds |
|
1 minute |
|
5 minutes |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Reference to the value to store (e.g., |
|
string |
Yes |
Name to identify this stored state |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
Confirmation message |
|
string |
The value that was stored |
|
string |
The variable name used |
|
string |
|
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"
Related Commands
-
PRINT_STORED_STATE - Print stored state value
-
COMPARE_STATES - Compare two stored states
-
EXTRACT_WITH_JSONPATH - Extract specific values to store
PRINT_STORED_STATE
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Name of the stored state to print |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
The stored value |
|
string |
The variable name |
|
string |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Name of first stored state |
|
string |
Yes |
Name of second stored state |
Outputs
| Output | Type | Description |
|---|---|---|
|
json |
JSON object with comparison details |
|
boolean |
|
|
string |
Name of first state |
|
string |
Name of second state |
|
array |
New elements in state2 |
|
array |
Elements removed from state1 |
|
array |
Elements that changed |
|
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"
Related Commands
-
STORE_STATE - Store states to compare
-
PRINT_STATE_COMPARISON - Print comparison result
-
EXTRACT_WITH_JSONPATH - Extract values for comparison
PRINT_STATE_COMPARISON
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Reference to comparison result (e.g., |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
Formatted comparison output |
|
boolean |
Whether states are equal |
|
string |
Brief summary of differences |
|
string |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Reference to source JSON data |
|
string |
Yes |
JSONPath expression |
|
string |
Yes |
Variable name for extracted value |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
Extracted value |
|
string |
The extracted value |
|
string |
The JSONPath used |
|
string |
|
JSONPath Examples
| Expression | Description |
|---|---|
|
Extract x coordinate from position |
|
Extract y coordinate from position |
|
Extract z coordinate from position |
|
Extract first item from array |
|
Extract name of first item |
|
Extract UUID of first entity |
|
Extract version field |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Reference to entities JSON data |
|
string |
Yes |
Filter criterion: |
|
string |
Yes |
Value to match |
Outputs
| Output | Type | Description |
|---|---|---|
|
json |
JSON array of matching entities |
|
number |
Number of matching entities |
|
array |
Array of entity objects |
|
string |
|
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"
Related Commands
-
EXTRACT_WITH_JSONPATH - Extract from filtered results
-
ASSERT_RESPONSE_CONTAINS - Check filter results
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Player name to execute command |
|
string |
Yes |
Command to execute |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
Command response |
|
string |
|
|
string |
Human-readable status message |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Step identifier |
|
string |
No |
Human-readable description |
|
string |
Yes |
Player name to execute command |
|
string |
Yes |
Raw command string |
Outputs
| Output | Type | Description |
|---|---|---|
|
string |
Raw response from server |
|
string |
|
|
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 |
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Human-readable description |
|
string |
Yes |
Entity name to check |
|
boolean |
No |
Expected existence (default: true) |
Result
| Field | Type | Description |
|---|---|---|
|
boolean |
|
|
string |
Summary message |
|
string |
Entity existence status |
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Human-readable description |
|
string |
Yes |
Entity name to check |
Result
| Field | Type | Description |
|---|---|---|
|
boolean |
|
|
string |
Summary message |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Human-readable description |
|
string |
Yes |
Reference to response data |
|
string |
Yes |
Expected content |
Result
| Field | Type | Description |
|---|---|---|
|
boolean |
|
|
string |
Summary message |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Human-readable description |
|
string |
Yes |
Reference to JSON data |
|
string |
Yes |
Expected JSON structure |
Result
| Field | Type | Description |
|---|---|---|
|
boolean |
|
|
string |
Summary message |
|
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Human-readable description |
|
string |
Yes |
Regex pattern to search in logs |
Result
| Field | Type | Description |
|---|---|---|
|
boolean |
|
|
string |
Summary message |
|
string |
Match details |
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 |
|---|---|---|---|
|
string |
Yes |
Must be |
|
string |
No |
Human-readable description |
|
string |
Yes |
Condition to evaluate |
Result
| Field | Type | Description |
|---|---|---|
|
boolean |
|
|
string |
Summary message |
|
string |
Condition evaluation result |
Command Summary
| Command | Purpose | Key Outputs |
|---|---|---|
Pause test execution |
|
|
Store state for later use |
|
|
Compare two stored states |
|
|
Extract values from JSON |
|
|
Filter entities by criteria |
|
|
Execute command as player |
|
|
Execute raw player command |
|
|
Assert entity exists |
|
|
Assert entity does not exist |
|
|
Assert response content |
|
|
Assert JSON structure |
|
|
Assert log pattern |
|
|
Assert custom condition |
|
See Also
-
Server Commands - Server-side operations
-
Player Commands - Player operations
-
Writing Stories - How to use commands in stories