Skip to main content
The Persistence surface lets you verify that world save paths are configured and that the player storage system is accessible. PersistenceTestAdapter provides direct lookups, while PersistenceAssert wraps them as failing assertions with clear messages. Persistence testing matters because silent save failures are the worst kind of bug - players lose progress with no error message. These tests verify that the save infrastructure is wired up correctly before your mod tries to persist data.

Complete Example Suite

Adapter Methods

Assertion Methods

When to Test Persistence

Persistence tests are valuable as:
  • Smoke tests - Run on every build to verify the save infrastructure is wired up
  • Precondition guards - Check save path existence before running tests that persist data
  • Build validation - Catch server configurations where persistence is accidentally disabled
Use playerStorageAvailable() from the adapter as a precondition guard before running tests that depend on player data persistence.

Next Steps