This document describes the testing approach for this mod and clarifies the distinction between Unit Tests and Integration Tests.
Unit tests are located in src/test/java/ and are executed during the build process using ./gradlew test.
- Input Validation: Ensuring that tool arguments (like coordinates) are complete and valid.
- Timing Logic: Verifying that deferred tasks (e.g., waiting for frames after teleportation) are executed after the correct number of ticks.
- Data Processing: Verifying that data transformation (e.g., Base64 encoding) is performed correctly.
- Protocol Structure: Ensuring that MCP response objects match the expected JSON schema.
Standard unit tests run in a headless environment without a running Minecraft instance. Therefore, they cannot test:
- Actual game screen capture (requires GPU and OpenGL context).
- Player teleportation within the game world.
- Interaction with live game objects (entities, blocks, world state).
- File IO dependent on
FabricLoaderpaths.
Due to the nature of Minecraft modding, core rendering and world-interaction features must be verified manually or through integration testing.
Advanced integration testing can be performed using the Fabric Game Test API, which allows running tests within a minimized game instance. This is currently not implemented in the CI pipeline but can be added for future robustness.
- Launch the Minecraft client with the mod installed.
- Connect an AI agent or use an MCP client (like Claude Desktop).
- Call the
take_screenshottool with specific coordinates. - Verify that:
- The player is teleported to the correct location.
- The received image correctly reflects the view from those coordinates.
- (If enabled) The image is saved to the
mcp_debug_screenshots/folder.