Skip to content

πŸ§ͺ Raise server unit-test coverage (81.8% line baseline, tooling included)Β #571

Description

@marceld23

What this is

Help raising the server unit-test coverage. The tooling is already in the repo, the low-hanging targets are known, and CI verifies your work objectively β€” a great first code contribution.

Current baseline (June 2026, may have drifted slightly)

Line 81.8% / branch 73.8% / method 88.8%, per assembly:

Assembly Line coverage
Persistence 96.5%
WorldGeneration 93.9%
Shared 85.7%
GameServer 78.7%
Api 68.4%
Networking 59.3%

⚠️ Don't chase the raw numbers blindly: a big share of the low Api/Networking figures is intentionally-untested I/O (LiteNetLib/WebSocket transports, HTML page rendering, console logger). The valuable targets are pure, deterministic logic that currently lacks tests.

Suggested targets (verify names/constants against current source first)

  • Primitive types β€” Vector3i, ChunkCoord, BlockId: equality, hashing, distance
  • FrequencyExtensions β€” weight/probability factors per enum level
  • Server presets β€” lookup case-insensitivity, unknown-name handling
  • Localizer β€” hit / fallback / unknown-key wrap / empty key
  • Mission validation β€” each error case (empty id, no objectives, unknown type/target)
  • Noise + deterministic RNG β€” same seed β†’ same output, output ranges, seamless wrap
  • World/structure state β€” block modifier set/get roundtrips, air-clears-modifiers

How to run

  • Fast daily loop: dotnet test -c Release --filter Category!=Slow
  • Full coverage report: ./scripts/test-coverage.ps1 -Open (uses coverlet.runsettings; slow β€” ~30 min β€” because the worldgen tests are heavy under the collector)

CI rules that will bite you (warnings are errors)

  • Async test methods need an Async suffix (VSTHRD200)
  • Don't await a TaskCompletionSource in tests (VSTHRD003) β€” use SemaphoreSlim
  • Any non-Slow-tagged test must finish well under 120 s

Metadata

Metadata

Assignees

Labels

area: serverGameServer / Networking / WorldHost / Api / Persistencegood first issueGood for newcomershelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions