Log Check Tests
worldCreateSaveTest loads your mod on a game test server, creates and saves a world, and then checks that every log line you listed in build.gradle.kts appeared. No window opens.
tasks.named<dev.polymodloader.devtools.gradle.minecraft.VerifiedGameRunTask>("worldCreateSaveTest") {
expectedOutput.add("[ruby_mod] Hello from ruby_mod 0.1.0")
}
- Windows (PowerShell)
- macOS · Linux (bash)
.\gradlew.bat worldCreateSaveTest
./gradlew worldCreateSaveTest
- Use it to check the "execution path", for example whether the entrypoint ran and whether the server started.
- Write the log lines from your mod code with SLF4J.
static final Logger LOGGER = LoggerFactory.getLogger("ruby_mod");
LOGGER.info("[ruby_mod] Hello from {} {}", mod.modId(), mod.modVersion());
Log lines and files to check
worldCreateSaveTest, gameTests, and serverBootSmokeTest are the same task type (VerifiedGameRunTask). Two properties list what to check.
| Property | Meaning |
|---|---|
expectedOutput | Strings that must appear in the game output. A partial match of a line is enough |
expectedFiles | Files and folders that must exist after the game ends. Paths are relative to the run directory |
tasks.named<dev.polymodloader.devtools.gradle.minecraft.VerifiedGameRunTask>("worldCreateSaveTest") {
expectedOutput.add("[ruby_mod] Hello from ruby_mod 0.1.0")
expectedFiles.add(".poly/startup-report.json")
}
addadds to the items the task already checks.setreplaces the original items.- The world of
worldCreateSaveTestis saved inuniverse/gametestworld/in the run directory. - Poly Mod Loader reports appear in
.poly/in the run directory (Troubleshooting).
What the tasks check by default
The mod plugin adds these items when it creates the tasks. The items you write are added to them.
| Task | Default log line | Default file |
|---|---|---|
worldCreateSaveTest | All 1 required tests passed | universe/gametestworld/level.dat |
gameTests | required tests passed | None |
serverBootSmokeTest | None | None |
clientWorldReloadTest | joined the game | — |
A check task works like this.
- It deletes the run directory (
build/poly/…) and starts in an empty directory. - It shows the game output in the console and collects it.
- When the game ends, it writes the whole output to
verified-run-output.login the run directory. - If even one log line (
missing log line: …) or file (missing file: …) is missing, the task fails. The error message shows the path of the output log. - If everything is there, it prints
… passed (N log lines, M files verified).
Client check
clientWorldReloadTest is a different task type (ClientWorldReloadTask). It copies the world that worldCreateSaveTest saved into the client's saves/ and opens it right away. The client cannot run without a window, so a window opens briefly.
tasks.named<dev.polymodloader.devtools.gradle.minecraft.ClientWorldReloadTask>("clientWorldReloadTest") {
// The common entrypoint also runs on the client.
expectedOutput.add("[ruby_mod] Hello from ruby_mod 0.1.0")
}
| Property | Meaning |
|---|---|
expectedOutput | Strings that must appear in the client output |
timeoutSeconds | Maximum time to wait (180 seconds by default) |
systemProperties | Java system properties to pass to the client (key=value) |
- When every expected line has appeared, it closes the client and passes.
- If the lines do not all appear in time, or the client ends first, it reports the missing lines and fails.
- The whole output is in
client-world-reload-output.login the run directory.
Check game behavior with in-game tests, and check flows such as load, start, and save with log check tests.