Development Testing
How the n3Client automated suite is organized — per-module test roots, conventions, the fresh-root policy, the manager security scan wall, and how to run the tests.
How the automated suite is organized, what it guarantees, and how to run it. Test counts and pass status live in the validation ledger — this guide owns structure and conventions only. Source of truth: docs/development/testing.md in the n3Client repository.
Where tests live
Each Gradle module owns its tests under src/test/java, mirroring the production package (repository rule in AGENTS.md). Four test roots exist:
| Module | Test root | Contents |
|---|---|---|
root (src) | src/test/java/dev/n3u/ | JVM-level contracts: JdkVersionTest (fresh home needs no installed launcher or remote version lookup), StorageIsolationTest (configured root owns every directory; sideloads stay in the legacy RuneLite directory; config cannot escape the root), lookup/PluginLookupTest (cross-plugin-module subscriber lookup), patch/PatchInputsTest (patch identity/acceptance rules, old-namespace rejection, missing-identity rejection) |
base-api | — no test sourceset (base-api/src contains only main) | covered indirectly through its consumers |
api | api/src/test/java/dev/n3u/ | api/widgets/BankQuantityResolverTest, services/pathfinder/collision/MapResourcesTest, ui/NOverlayTest, ui/sdn/NExternalsPanelTest |
plugins | plugins/src/test/java/dev/n3u/plugins/ | 8 suites: bankvaluer/BankValuerPanelTest, breakhandler/ui/BreakPanelTest, codeeval/ConsoleOutputBufferTest, preview/ControlSurfacePreviewTest, preview/OptionPanelLayoutTest, preview/PluginPanelsPreviewTest, preview/SharedControlsTest, profiles/panel/AddLegacyAccountPanelTest — the preview suites render real plugin panels |
manager | manager/src/test/java/dev/n3u/manager/ | one suite per package — this single test root holds 13 test packages of varying size (audit, collect, db, importd, net, observability, retention, security, service, session, status, ui, vault); shared fakes/stubs live inside collect (5 test classes plus FakeClock, StubHiscoresClient, StubRateLimiter, StubStatusEngine) and net (StubHttp, StubTempleClient) |
plugins/src/test/java/dev/n3u/plugins/preview/ControlSurfacePreview.java (test source set) backs the renderUiPreview Gradle task (plugins/build.gradle.kts runs it from sourceSets["test"]), which renders the panel previews to build/reports/n3-ui.
Conventions
- JUnit Jupiter on the JUnit Platform (JUnit BOM
org.junit:junit-bom:5.13.4withjunit-platform-launcheron the test runtime — see each module'sbuild.gradle.kts). Test classes are named*Test. - Deterministic, fresh-fixture state. The repo skill
.agents/skills/n3-test-authoring/SKILL.mdis the design reference: select seams that exercise the normal entry point, assert behavior rather than internal calls, incompatible patch inputs fail before application, shared N interfaces stay assignable across real loader boundaries, and a restart reads only its isolated fixture root. - No coverage threshold is enforced (
AGENTS.md); cover changed behavior and edge cases.
Fresh-root policy in tests
Tests never touch a real ~/.n3client. ClientPaths.ROOT (base-api/src/main/java/dev/n3u/ClientPaths.java:7-9) resolves the n3client.home system property first, so a test JVM can point the whole storage family (runelite/, client/, logs/, repository/, cache/) at a fixture directory; StorageIsolationTest asserts the configured root owns every directory and rejects escape. Manager DB tests use manager/src/test/java/dev/n3u/manager/db/TestDb.java, which opens a temp-file SQLite database with all migrations applied. External collaborators are stubbed, not mocked over the network: FakeClock, StubHiscoresClient, StubRateLimiter, StubStatusEngine (collect), StubHttp, StubTempleClient (net).
The security scan wall (manager)
manager/src/test/java/dev/n3u/manager/security/ holds five tests that scan outputs for secret leakage: SecretInLogScanTest, DbDumpScanTest, ExportRedactionScanTest, RevealAuditAssertionTest, SecretScrubberTest. These run against a real logback backend (ch.qos.logback:logback-classic is test-scope only; slf4j-simple is excluded from the manager test runtime classpath — manager/build.gradle.kts). Any new logging or export path in the manager must keep these green; the masking convention itself is documented in the Manager guide.
External-plugin acceptance fixture
src/foundationFixture compiles through the compileFoundationFixture task (options.release.set(11)) into foundation-fixture.jar (build.gradle.kts, verification group) — an explicitly staged external plugin used for loader acceptance, not part of the shipped client.
Running tests
From the repository root (wrapper; Temurin JDK 25 HotSpot as JAVA_HOME):
.\gradlew.bat build :: all modules, tests included
.\gradlew.bat :api:test --tests dev.n3u.api.widgets.BankQuantityResolverTest :: focused class
.\gradlew.bat :manager:test :: manager suite
.\gradlew.bat :plugins:renderUiPreview :: regenerate panel preview PNGsThe Java 11 compatibility pass runs the same suite on a JDK 11 launcher:
.\gradlew.bat test -PtestJavaVersion=11 -Porg.gradle.java.installations.paths=<path-to-jdk11>,<path-to-jdk25>build.gradle.kts:459-460 wires the test javaLauncher to the testJavaVersion Gradle property (default 25). CI runs both passes — see docs/development/GITHUB.md §CI for the exact step order and toolchains.
What the suite guarantees — and what it does not
The most recent full-suite receipt is the repository's docs/development/VALIDATION.md (VAL-015, 2026-11-06: 298 tests — root 12, API 9, plugins 10, manager 267 — on JDK 25 and the same count on the JDK 11 pass; not rerun for the guide). A static recount of the current tree finds 296 @Test annotations (root 12, API 9, plugins 10, manager 265, with no @ParameterizedTest/@TestFactory/@RepeatedTest anywhere), two short of the recorded manager total; the drift is logged in the repository's docs/development/evidence/documentation-review-2026-11-06.md (B4). Tests do not establish native startup, generated-patch live compatibility, packaged launch or gameplay acceptance; those remain separately recorded live gates (docs/development/GITHUB.md §CI, docs/development/FOUNDATION.md).
Documentation gate
scripts/check_development_docs.py does exactly two things: it verifies that every relative Markdown link under docs/development/**/*.md resolves, and it requires docs/development/skill-investigations/README.md to exist. Its scope excludes docs/*.md — a broken link in FEATURES.md or an sdk-*.md reference is not caught by CI, so check those by hand. The gate runs as the first CI step (docs/development/GITHUB.md §CI).
Launch scripts (packaged client)
Three scripts launch the packaged client — scripts/run-windows.bat, scripts/run-linux.sh, scripts/run-mac.sh. Each runs the N3Client.jar sitting next to the script (entry point dev.n3u.N3Client per the jar manifest, re-checked by scripts/check_distribution.py) and forwards all arguments (%* / "$@"). If JAVA_HOME already points at a JDK 25, the scripts exec it directly; otherwise they auto-provision the pinned Temurin JDK 25.0.5+8 into the fresh root — %USERPROFILE%\.n3client\jdk on Windows (PowerShell download) and $HOME/.n3client/jdk elsewhere (curl + tar; macOS extracts the Contents/Home layout and clears the quarantine attribute). The manager launchers (run-manager.bat / run-manager.sh, both passing --enable-native-access=ALL-UNNAMED) are described in the Manager guide. Scripts launching the app is not a live-acceptance receipt — startup gates are recorded separately (docs/development/FOUNDATION.md, docs/development/GITHUB.md).
Injection DSL
The n3Client bytecode injection DSL — annotations, transformers, mixin pairing, the gamepack and RuneLite mixin catalogs, and pipeline failure behavior.
UI Components
The owned Swing toolkit and N3Theme design tokens — shared widgets, diagnostic panels, accessibility rules, and test previews for n3Client plugin panels.