ValheimTesting
Release 0.1.0, built from source 2204f554da12. This documentation is immutable; the unversioned site follows current source.
ValheimTesting gives you automated tests for Valheim mods built on BepInEx: unit tests that run against game doubles with no game, and native checks that drive a real dedicated server and client. It is for mod authors, and most of its tests run without Valheim, Unity, Steam or a dedicated server.
Your first test
Install the .NET 10 SDK on the PC where you build your mod.
Copy
MyMod.Tests/from the ModWithTests example beside your mod. Keep itsValheim.Testing.Doublesreference, and pointCompile Includeat one of your mod's source files:<Compile Include="../YourMod/YourRule.cs" Link="Mod/YourRule.cs" />Run the tests from your mod checkout. A passing run exits 0:
dotnet test MyMod.Tests/MyMod.Tests.csproj -c Release
Get started walks through it with output and the GitHub Actions workflow.
Find the guide for your task
| I want to | Read |
|---|---|
| I do not know which kind of test I need | Choose a test layer |
| Test mod code that calls Valheim or Unity types | Test logic that uses game types |
| Test heights, slopes, biomes or zone seams without the game | Test terrain decisions |
| Run my tests on every push and pull request | Run tests in CI |
| Pin a package version | Packages |
| Check that a mod loads on a dedicated server | Your first server load check |
| Find which mod breaks a load, alone or with others | Check that a mod loads |
| Prepare the machine and mod for a run of the real game | Before a native run |
| Find why a native run refused or failed, or clean up after it | Debug a native run |
Look up a valheim-test command or option |
valheim-test |
| Let my coding agent add and run the tests | Give your coding agent the workflow |
Reference
- Packages: every package, version and pin.
- API reference: the public types, generated from source.
- Package pages: each package has its own page. Start with
Valheim.Testing.
Source, issues and contributions: github.com/tvongaza/ValheimTesting.