|
| 1 | +# endstone-test |
| 2 | + |
| 3 | +An Endstone plugin that runs pytest-based tests against a live Bedrock Dedicated Server to verify API functionality. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This plugin is used for runtime testing of the Endstone API. Unlike unit tests that run in isolation, these tests execute within a running server environment, allowing verification of actual API behavior against the Bedrock Dedicated Server. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +Install the plugin as a Python package from the project root: |
| 12 | + |
| 13 | +```shell |
| 14 | +pip install -e tests/endstone_test |
| 15 | +``` |
| 16 | + |
| 17 | +The plugin will be automatically discovered and loaded by Endstone on server startup. |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +Tests run automatically when the plugin is enabled (after the world loads). Test results are output to the server console. |
| 22 | + |
| 23 | +## Project Structure |
| 24 | + |
| 25 | +``` |
| 26 | +tests/endstone_test/ |
| 27 | +├── pyproject.toml # Package configuration |
| 28 | +├── README.md |
| 29 | +└── src/ |
| 30 | + └── endstone_test/ |
| 31 | + ├── __init__.py |
| 32 | + ├── plugin.py # Plugin entry point |
| 33 | + └── tests/ |
| 34 | + ├── __init__.py |
| 35 | + ├── conftest.py # Pytest fixtures (server, plugin) |
| 36 | + └── test_server.py # Server API tests |
| 37 | +``` |
| 38 | + |
| 39 | +## Writing Tests |
| 40 | + |
| 41 | +Tests use pytest and have access to the live `server` and `plugin` fixtures: |
| 42 | + |
| 43 | +```python |
| 44 | +from endstone import Server |
| 45 | + |
| 46 | +def test_server_name(server: Server) -> None: |
| 47 | + """Verify server name is 'Endstone'.""" |
| 48 | + assert server.name == "Endstone" |
| 49 | +``` |
| 50 | + |
| 51 | +### Available Fixtures |
| 52 | + |
| 53 | +- `server` - The Endstone `Server` instance |
| 54 | +- `plugin` - The `EndstoneTest` plugin instance |
| 55 | + |
| 56 | +### Test Categories |
| 57 | + |
| 58 | +Current test coverage includes: |
| 59 | + |
| 60 | +- **Server Information** - Version, protocol, and metadata |
| 61 | +- **Server Components** - Logger, language, plugin manager, scheduler |
| 62 | +- **Level Access** - World/dimension access |
| 63 | +- **Player Management** - Online players, max players |
| 64 | +- **Network Configuration** - Ports, online mode |
| 65 | +- **Performance Metrics** - TPS, MSPT, tick usage |
| 66 | +- **Item Factory** - Item creation APIs |
| 67 | +- **Map System** - Map creation and retrieval |
| 68 | +- **Broadcasting** - Message broadcast functionality |
| 69 | + |
| 70 | +## Dependencies |
| 71 | + |
| 72 | +- `pytest` - Test framework |
| 73 | +- `babel` - Internationalization support |
| 74 | +- `pillow` - Image processing (for map tests) |
0 commit comments