Testing
In short
There are no NUnit tests. Each system has an Editor self-test: a static
Run()inAssets/_Project/Editor/that you start from Tools → Home Run Derby (results in the Console) or headless (exit code 0 or 1). Before asking for a playtest, run the tests that touch your change, run the headless compile check with the Editor closed, then play it by hand.
The self-tests
All live in Assets/_Project/Editor/, namespace HomeRunDerby.EditorTools. Each logs XTest PASSED or
XTest FAILED (n) with one red line per failure, and in batch mode exits with 0 or 1.
| Menu item (Tools → Home Run Derby → …) | Class | What it checks |
|---|---|---|
| Run Run Structure Test | RunStructureTest | 9 innings with bosses in 3, 6, 9; same seed same innings; a park’s own boss in inning 9; goals per map and difficulty; unlock order; dev map tools; the insta-home-run clears every wall; reset upgrades; coins and outs; the co-op start message carries the map |
| Run Progression XP Test | ProgressionXpTest | account and character XP curves and caps; run XP; batter perks at 2 / 5 / 10 (and runs include them); cosmetics and batters gated by account level; call signs; what AwardXp reports; an old save loads at level 1 |
| Run Ball Effect Test | BallEffectTest | each special ball’s flight (incl. Wiffle and the Headwind / Tailwind gusts); boss and park balls stack; The Phantom’s decoys; every park’s own boss; pitch arcs and sideways loops; pitchers lean on special-ball pitches; only named pitches get one; balls never shift the pitch sequence; Super Fast is faster; the chance; the pitch message carries the ball; Describe text |
| Run Batting Model Test | BattingModelTest | the Mario-style batting: contact zones and Contact, GREEN and the replay rule, exit velocity per zone, launch odds and W / S, A / D aim, the curve, hooking foul (Batting Explained) |
| Run Hit Tally Test | HitTallyTest | the live hit counter, score stack, big moments, tracer framing and flight camera on every park; every TEST HITS kind (Hit Show) |
| Run Scoreboard Smash Test | ScoreboardSmashTest | a monster home run at the board smashes it and drops in front; a ball beside it flies past; an ordinary home run never reaches it (except on a practice map); logs how hard you must hit it per park |
| Smash Scoreboard (Play mode) | ScoreboardSmashTest.SmashNow | not a test: breaks the board in the current park through the real event, to look at the effect |
| Net → Run Co-op Rules Test | CoopRulesTest | the co-op referee: pool size, opener rotation, one out per turn, clearing mid-turn, failing, the second life, players dropping, wrong batter rejected |
| Net → Run Session Test | NetSessionTest | the lobby end to end over LocalTransport in-process (port 7811): roster and unique names, batter changes, a different build refused, START reaches all, leaving; plus round trips of every co-op run message |
| Net → Run Spectate Feed Test | SpectateFeedTest | the spectator playback buffer under delay, jitter and out-of-order poses; spectating message round trips |
| Net → Run Match Intro Test | MatchIntroTest | the intro card against real data, the beat script for 1 to 4 players, the cutscene runner, every camera shot, the co-op intro gate (Cutscenes) |
| Net → Run Outro Test | OutroTest | the outro beat scripts, the line score and boss bonus, the replay path, every outro shot on every park, the pitcher’s fall |
| Preview Match Intro, Preview Outro: … | MatchIntroTools | not tests: play a cutscene in Play mode, to look at it |
| Net → Run Local Transport Self-Test | NetSelfTest | LocalTransport on localhost (port 7799): a host and two clients connect, reliable in-order burst, an unreliable message, a clean leave |
Most tests build their own content with DefaultContent.Build() and an in-memory save (persist: false), so they never
touch your real save. ScoreboardSmashTest, HitTallyTest, MatchIntroTest and OutroTest use ContentDatabase.LoadOrDefault() instead.
Headless, with the Editor closed, from the project folder:
unity run . -- -executeMethod HomeRunDerby.EditorTools.RunStructureTest.RunSwap in any class name from the table. The exit code is the result; details are in Logs/Editor.log.
The headless compile check
With the Editor closed, from the project folder:
unity run . -- -executeMethod HomeRunDerby.EditorTools.UrpSetup.RunOpening the project in batch mode compiles every script; if anything fails to compile, the method can’t run. Then
read Logs/Editor.log and search for error CS (C# errors) or the shader name for shader errors. Any self-test’s
Run works the same way and also checks behaviour.
It is not read-only
UrpSetup.Runreally runs: it re-assigns the URP asset and converts Built-in materials, then saves assets. Checkgit statusafterwards and don’t commit churn you didn’t mean. Its own doc comment adds-quit; the self-tests quit by themselves in batch mode. Whetherunity runquits without-quitis not determined from the code.
What to playtest by hand
Self-tests don’t cover feel, screens or co-op over a real network. Before a PR (see Git and PRs):
- The change itself, with the dev menu (F1) to get there fast: give upgrades, jump innings, force special balls or pitch types, set levels, unlock maps (Dev Menu and Shortcuts).
- A run start to finish if run flow, scoring, the shop or progression changed: pick a map, clear innings, buy in the shop, finish (F1 → RUN → beat the map tests the results screen and unlocks).
- Save and resume: quit from the pause menu (SAVE & QUIT TO MENU) and continue.
- Cutscenes if the intro, outros or anything they show changed: F1 → CUTSCENES plays the match intro, BOSS DOWN, MAP BEATEN or GAME OVER at 1x, 1/2x or 1/4x on any park; in the Editor, on a solo run’s map, I / B / V / G do the same (Shift: quarter speed). Check Settings → CUTSCENES off as well (Cutscenes).
- Batted balls if batting, the counter or the camera changed: F1 → PITCHING → TEST HITS turns every swing into a chosen hit (grounder to upper deck); REPLAY EVERY HOME RUN and RUN → REPLAY LAST HIT show the replay on demand (Hit Show).
- Real swings data: every pitch is logged to
swings.csv; F1 → PROGRESS → OPEN THE LOG’S FOLDER finds it, so playtesters can send it (Swing Log). - Menus: title screen, CUSTOMIZE, PERKS, INDEX, SETTINGS, batting cage, the map-select carousel.
- Co-op if net or rules changed: two copies on LOCAL (a build plus the Editor), or two PCs on Steam (Steam Test Guide). Ctrl+Shift+N opens the NET TEST overlay.
- A Windows build for friends: Tools → Home Run Derby → Build → Windows Player (zip) (Build and Release).
- Reset: Tools → Home Run Derby → Delete Save File clears meta progress and any saved run.
GitHub templates (.github/)
pull_request_template.md: what changed, which part of the game, how you tested it, screenshots, and a checklist (opens in 6000.6.6f1 with no red errors, pressed Play,.metafiles, no generated folders, no shared scene edits).ISSUE_TEMPLATE/bug_report.md(labelbug): what happened, expected, steps, first red Console line, branch or commit.ISSUE_TEMPLATE/feature_idea.md(labelidea): the idea, the area, why it’s fun, who builds it.
Gotchas
MatchIntroTestandOutroTestsit under the Net submenu even though they open no ports.- The net tests open real localhost UDP ports (7799, 7811). A running game or another test on that port makes them fail.
- A test that edits shared content puts it back in
finally(for exampleParkBossPitchesTheLastInning). Do the same in new tests. - New content can break existing tests on purpose: every batter needs perks at 2, 5 and 10; free cosmetics need no level; every park must let the insta-home-run clear its wall.
Related
- Editor Tools and Tests: every Editor tool, not just tests
- Dev Menu and Shortcuts: F1 and the hotkeys
- Unity Setup · Git and PRs · Build and Release