Guides

In-depth guides for writing effective tests with Pilaf.

Test Writing

Integration

Common Scenarios

Testing Plugin Commands

Use execute_player_command to test your plugin’s commands:

{
  name: 'Test plugin version command',
  action: 'execute_player_command',
  player: 'testplayer',
  command: '/myplugin version'
}

Testing Entity Interactions

Use get_entities with entity_exists assertions:

steps: [
  { action: 'get_entities', player: 'p', store_as: 'e' },
  { action: 'assert', condition: 'entity_exists', expected: 'zombie', actual: '{e}' }
]

Testing Inventory

Use get_player_inventory with has_item assertions:

steps: [
  { action: 'execute_command', command: 'give p diamond' },
  { action: 'get_player_inventory', player: 'p', store_as: 'inv' },
  { action: 'assert', condition: 'has_item', expected: 'diamond', actual: '{inv}' }
]

Need More?


Table of contents


Back to top

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

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