Wiki 9Minecraft Wiki 9Minecraft

Swift Adventure Lab Mod FAQ

10 questions players actually ask, answered.

How do I create my first test?
Create a folder named `test` inside your data pack's namespace directory (e.g., `data/mypack/function/test/`), then add an `.mcfunction` file with your test logic. Use `/assert` or `/await` commands to check conditions, and run `/test run ` to execute it.
What's the difference between /assert and /await?
`/assert` checks a condition immediately and fails the test if it's false, while `/await` repeatedly checks a condition each tick until it succeeds or times out, making it useful for testing events that happen over multiple ticks.
How do I test player interactions like mining or attacking?
Use the `/dummy` command to spawn a controllable fake player, then use `/dummy mine ` or `/dummy attack ` to make it perform actions. Clean up with `/dummy leave` when done.
Can I set up a test environment automatically?
Yes, use the `@template` directive at the top of your test file to load a structure, or use `@dummy` to pre-spawn fake players. You can also use `@timeout` to set how long a test can run before failing.
How do I wait for something to happen without a fixed delay?
Use `/await ` to check a condition every tick until it's true, or use `/await delay ` if you need a fixed pause. This is better than guessing tick counts because it waits only as long as needed.
What should I check to debug a failing test?
Run `/test runfailed` to re-run only the tests that failed, then check the in-game chat log for the failure message and which assertion or await command stopped the test. Use `/test runthis` while standing near a test file to run just that one.
Can I run tests on a headless server?
Yes, the mod supports headless server environments and outputs automated exit codes and GitHub workflow annotations, making it suitable for continuous integration pipelines without a graphical interface.
How do I check NBT data or entity selectors in a test?
Use `/assert` with entity selectors like `@e[nbt={...}]` to verify NBT conditions, or check scores with `/assert` against scoreboard values. You can also verify predicates and recent chat messages.
What happens if I don't clean up dummy players?
Dummy players persist in the world and can interfere with subsequent tests or your game state. Always use `/dummy leave` at the end of your test or in a cleanup section to remove them.
Can I run tests from multiple data packs at once?
Yes, `/test runall` executes every test across all loaded data packs, or use `/test runall ` to run tests from a specific namespace only.