Valheim.Testing.GameSessions 0.2.0

dotnet add package Valheim.Testing.GameSessions --version 0.2.0
                    
NuGet\Install-Package Valheim.Testing.GameSessions -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Valheim.Testing.GameSessions" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Valheim.Testing.GameSessions" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Valheim.Testing.GameSessions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Valheim.Testing.GameSessions --version 0.2.0
                    
#r "nuget: Valheim.Testing.GameSessions, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Valheim.Testing.GameSessions@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Valheim.Testing.GameSessions&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Valheim.Testing.GameSessions&version=0.2.0
                    
Install as a Cake Tool

Valheim.Testing.GameSessions

API reference. This page is the package's README; each type's members are in the reference.

Valheim.Testing.GameSessions runs game sessions for mod tests: a dedicated server with its clients, a client hosting a world with its peers, or a server on another machine, prepared, started, joined and torn down as one run. It is built on Valheim.Testing.Game, which drives one game process. Unofficial community tooling; not affiliated with or endorsed by Iron Gate or Coffee Stain. Valheim is a trademark of Iron Gate AB.

You want Use
Observe or drive one game, or a joining client's rounds Valheim.Testing.Game alone
A dedicated server and a client, with a save and restart This package: PinnedServerRun
A hosting client's rounds, driven by your code This package: HostedClientRounds.Run (game sessions)
Two builds of your mod in one scenario This package: TargetedRegression
A server on another machine, or several clients This package: an inventory file and a campaign

Install

Add both packages to a separate system-test project, never to the mod. It targets net10.0.

<PackageReference Include="Valheim.Testing.Game" Version="[0.1.0]" />
<PackageReference Include="Valheim.Testing.GameSessions" Version="[0.1.0]" />

Brackets pin an exact version; the released versions are in the package table. This package depends on exactly the Valheim.Testing.Game version it was built with, so the two always restore as the pair that was tested together.

using Valheim.Testing.Game;
using Valheim.Testing.GameSessions;

A first session

Copy the FullLifecycle example: one dedicated server and one client on this machine, with a save, a restart and a rejoin. Test that a change survives a save, restart and rejoin walks through it. Your scenario receives the started session:

public static void Run(GameSession session, MarkerPlan plan) =>
    Run(plan, session.Server!.Game, session.Server!, () => session.OpenClient(plan.Client!), session.Report, session.Output, session.Cancellation);

For xUnit, copy GameSessionFixture.cs and the skip pattern in ExampleSession.cs. Without its private session files, the native test is skipped with the reason, so dotnet test stays offline.

What every run does

Behaviour Rule
Profiles Each owned process runs from a disposable loader profile; the install is only read, and its game files are hard-linked into the profile (a macOS client runs its bundle in place), never copied (profiles)
Hosts Each machine is a host with one shell; Linux hosts run the dedicated server only (game hosts)
Claims A run takes each host's lock and leases each client's Steam account (locks and leases)
Journal Every profile, copy, character and process is journalled before it is made, for valheim-test env status and env recover
User files A client's recent-servers list is moved aside before launch and restored after (the user's files)
Report result.json and junit.xml, with every step's phase and four states (phases and states)

Reference pages

Types Page
GameSession, ServerActor, ClientActor, HostingClientActor, HostedClientRounds Game sessions
PinnedServerRun, PinnedServerRunOptions<TPlan>, ModDeclaration Pinned server runner
IGameHost, HostServer, InteractiveClient Game hosts
EnvironmentInventory with a file Inventory file
The profile contract, --in-place Disposable profiles
SteamAccountHold, EnvironmentRuns, OwnedCopies, RunCancellation Locks, leases and recovery
HostedCampaignManifest, HostedCampaignPreparation Campaigns
TargetedRegression, StagedArm Targeted regression
WorldDump Pinned world dumps
ReviewCapture, ReviewClip Evidence

Profiles and hosts explains the ideas behind these pages.

Test fakes

FakeGameSession.Create and FakeGameSession.Hosted, in Valheim.Testing.GameSessions.Fakes, build a session over scripted clients, with no game. The Valheim.Testing.Game fakes work with them.

Limits

  • A pass with fakes is an orchestration test, not an in-game pass.
  • A client runs only in a signed-in desktop session with Steam; the toolkit never signs in to Steam.
  • The output holds local paths, account identifiers and a copy of the user's recent-servers list. Keep it private.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 49 10/21/2026
0.1.0 120 10/14/2026
0.1.0-rc.1 54 10/14/2026
0.1.0-preview.24 55 10/12/2026
0.1.0-preview.19 61 10/12/2026
0.1.0-preview.17 60 10/11/2026
0.1.0-preview.15 65 10/10/2026
0.1.0-preview.12 88 10/8/2026
0.1.0-preview.11 56 10/8/2026
0.1.0-preview.5 58 10/8/2026
0.1.0-preview.4 56 10/7/2026
0.1.0-preview.3 56 10/6/2026
0.1.0-preview.2 55 10/6/2026
0.1.0-preview.1 56 10/6/2026