Skip to main content
Version: Minecraft 26.2

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.

build.gradle.kts
tasks.named<dev.polymodloader.devtools.gradle.minecraft.VerifiedGameRunTask>("worldCreateSaveTest") {
expectedOutput.add("[ruby_mod] Hello from ruby_mod 0.1.0")
}
.\gradlew.bat 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.

PropertyMeaning
expectedOutputStrings that must appear in the game output. A partial match of a line is enough
expectedFilesFiles and folders that must exist after the game ends. Paths are relative to the run directory
build.gradle.kts
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")
}
  • add adds to the items the task already checks. set replaces the original items.
  • The world of worldCreateSaveTest is saved in universe/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.

TaskDefault log lineDefault file
worldCreateSaveTestAll 1 required tests passeduniverse/gametestworld/level.dat
gameTestsrequired tests passedNone
serverBootSmokeTestNoneNone
clientWorldReloadTestjoined the game—

A check task works like this.

  1. It deletes the run directory (build/poly/…) and starts in an empty directory.
  2. It shows the game output in the console and collects it.
  3. When the game ends, it writes the whole output to verified-run-output.log in the run directory.
  4. 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.
  5. 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.

build.gradle.kts
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")
}
PropertyMeaning
expectedOutputStrings that must appear in the client output
timeoutSecondsMaximum time to wait (180 seconds by default)
systemPropertiesJava 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.log in the run directory.
Use them together with in-game tests

Check game behavior with in-game tests, and check flows such as load, start, and save with log check tests.

Buy me a coffee