nowsprinting/unity-coding-skills/test-designing-guide
Claude Code and agent skill by nowsprinting/unity-coding-skills
- community
Checking that the SKILL.md file is still in the repository.
Provides test design methodology for Unity projects. Use this skill whenever designing test cases from requirements or specifications, including selecting test techniques, deriving test cases, and formatting them. Even for small features, load this skill to ensure test design rigor.
Install
npx vskill@latest install nowsprinting/unity-coding-skills/test-designing-guideSKILL.md
Guide for designing test cases for Unity projects.
Inputs
This skill requires the following inputs in its prompt:
| Input | Required | Description | |
|---|---|---|---|
| Requirements | Required | The feature requirements to test against | |
| Implementation design | Required | Class names, public method signatures, dependency interfaces, and design rationale | |
| Existing code context | Optional | File paths and class summaries of relevant existing code | |
| Language convention | Optional | Project language for test names and prose output (from CLAUDE.md). |
For bug-fix tasks, the Requirements input is the bug report (Condition / Expected / Actual), and the Implementation design input is the existing class/method structure of the affected production code — there is no new design.
The table above is the complete set of recognized inputs. Ignore anything else in the prompt — in particular test cases or manual test lists from a Plan agent (test design is this skill's sole responsibility) and output format overrides (the template in Section 6 is fixed).
1. Analyze Specifications
Read the requirements and identify testable specifications. If the specifications are unclear, use the AskUserQuestion tool to request clarification before proceeding. If the test target has low testability, flag it in the Testability Assessment (Section 7).
2. Assign Test Targets to Layers
For each test target, determine which layer it belongs to based on its nature and integration level:
- Editor tests — for Editor extension code (paths containing
/Editor/), asset file validation, and cross-asset consistency checks. - Unit tests — test runtime code whose execution is initiated by a direct method call. This includes tests that verify behavior driven by Unity's lifecycle (Awake, Start, Update, etc.) or UI events. Prioritize least integrated targets, testing them comprehensively; for highly integrated targets (where the SUT collaborates with dependent objects), keep test density low and focus on interactions between objects.
- Integration tests — test targets that are a scene or prefab (or an equivalent GameObject hierarchy assembled in test code), together with the interplay among its placed components (MonoBehaviour subclasses) and the assets they reference. Unit tests cover targets whose execution is initiated by a direct method call; integration tests cover behavior that only emerges from Unity's component wiring and asset linkage.
- Add the integration test method to the test class of the primary class involved; OR
- Create a new dedicated test class if there is no clear primary class (e.g., when the subject is a prefab or scene).
- Explicitly design integration tests before falling back to visual verification tests or manual tests; only drop to those layers when the behavior cannot be expressed as a functional assertion.
- When the asset itself is the SUT (file validation, cross-asset consistency), classify it as an Editor test, not an integration test; integration tests assert the runtime behavior that emerges from a scene/prefab's linkage to its assets.
- Visual verification tests — verify that actual on-screen rendering conforms to the intended design: positional relationships between elements, typography (font size, font style, and font family), text/background contrast and legibility, visual state representation (e.g., a disabled button looks grayed out), and rendering quality (no sprite distortion, ghosting, or unintended clipping). Take screenshots in the test code, and image analysis (see Section 4). A deterministic mid-point of an animation (e.g., an attack lunge at its peak, a fade-out at half time) can also be captured and verified here; only subjective motion feel belongs to manual tests. Design these before falling back to manual tests.
- Manual tests — reserved for items that neither automated tests nor image analysis can verify — i.e., items requiring human sensory judgment with no objective pass/fail criterion (e.g., game feel, animation polish, audio balance). Do NOT add manual tests for scenarios already covered by integration tests or visual verification tests, even if they seem "worth confirming by eye."
Note: Never use Edit Mode tests for runtime code logic. Edit Mode and Play Mode test runners cannot execute simultaneously — splitting coverage for a single SUT between the two modes prevents running all tests at once. Play Mode tests can run on actual devices (player builds), which Editor tests cannot.
3. Select Testing Techniques
Prefer specification-based tests over structural (implementation-coupled) tests. Structural tests break under refactoring and lose value fast. It's fine to write a structural test temporarily when you're unsure about an implementation, but plan to delete it once specification tests cover the same behavior.
For each test target, select appropriate techniques:
- Equivalence partitioning — group inputs into valid/invalid partitions; one representative per partition. When an invalid equivalence partition exists but the spec does not define its behavior (e.g., what happens for negative input, out-of-range values, null), use the
AskUserQuestiontool to confirm the expected behavior before deriving test cases. Do not guess or invent the behavior. - Boundary value analysis — test at the edges of each equivalence partition. Over-testing boundaries inflates the number of test cases and increases maintenance cost on every spec change. Mitigate this with parameterized tests that consolidate boundary cases into a single test method. When the spec doesn't differentiate behavior near edges (e.g., display color mapping), a representative per equivalence partition is sufficient and boundary testing can be skipped entirely.
- State transition testing — if the target has a finite-state-machine (FSM); one test case covers only 0-switch coverage (covering every direct transition from state A to state B, with no intermediate states in between)
- Decision table testing — if multiple conditions combine to produce different outcomes
- Error guessing — experience-based; derive cases from failure patterns common in game development. Examples to consider: rapid button mashing, simultaneous button press, input during scene transition / loading, collision tunneling, random distribution bias or PRNG sequence looping, numeric overflow, network failure. Use this to surface implementation concerns that spec-based techniques don't reach.
Deriving test methods from equivalence partitions
The most common derivation error is merging partitions with different expected outcomes into one (parameterized) method, encoding the difference as a condition in the name/Verification (e.g. ..._InteractableMatchesNonEmpty, "interactable is true only when non-empty"). One rule prevents it:
One test method = one equivalence partition = one definite expected outcome. Never parameterize the expected outcome. If the expected value changes with the input, the inputs belong to different partitions → separate test methods, each named after its own outcome.
For each input variable:
- Partition the input domain into classes the spec says produce the same outcome.
- Emit one method per partition, named
..._<Partition>_<ThatPartitionsOutcome>. The<Expected>segment is a concrete state/value (IsInteractable,IsNotInteractable), never a condition word (Matches…,…WhenNonEmpty,DependingOn…). - Within one partition, consolidate multiple representatives (and that partition's boundary values) into one parameterized method — they share the outcome (see Parameterized tests).
Worked example — drawPileButton.interactable driven by the draw pile count:
| Partition | Representative values | Expected outcome | |
|---|---|---|---|
Empty (count == 0) | 0 | interactable is false | |
Non-empty (count ≥ 1) | 1 (boundary), 5 | interactable is true |
Two partitions, two outcomes → two methods (NOT one parameterized method over {0, 1, 5}):
| Test Method | Verification | |
|---|---|---|
Sync_DrawPileIsEmpty_DrawPileButtonIsNotInteractable | the draw pile button is not interactable | |
Sync_DrawPileIsExist_DrawPileButtonIsInteractable (count: {1, 5}) | the draw pile button is interactable |
The non-empty method keeps both 1 and 5 because they share the outcome true; 1 is the partition's boundary value, 5 an interior representative.
Boundary value analysis locates where partitions meet. For a field valid in 1–99: partitions <1 / 1–99 / >99; boundaries 0, 1 and 99, 100. Fold each partition's boundary representatives into that partition's parameterized method (e.g., valid partition over {1, 99}) — never one method per boundary. When the spec does not differentiate behavior near an edge, one representative per partition suffices and boundaries can be skipped entirely (per the Boundary value analysis technique above).
Parameterized tests
When an equivalence partition includes multiple test cases — such as argument variations within the same partition or boundary values at the partition's edges — consolidate them into a single parameterized test. All cases must belong to the same equivalence partition and share the same expected outcome.
Specifying parameter name and values in the Test Method column — write values after the method name:
- Bool parameter, all values:
(flag: (bool)) - Enum parameter, all values:
(direction: (Direction)) - Multiple parameters, all combinations (exhaustive):
(param1: {0, 1, 2}, param2: {3, 4, 5})— when a param isboolor enum covering all its values, use the shorthand in place of the braces:(flag: (bool), count: {0, 1, 5}) - Multiple parameters, limited to specific combinations:
({param1: 0, param2: 3}, {param1: 1, param2: 4}) - Three or more parameters each with many values: write
(use pairwise)— the test-writing phase applies the pairwise (all-pairs) method to select a covering combination set
Do NOT over-consolidate: keep separate rows for tests that belong to different equivalence partitions or produce different expected outcomes.
Invalid partition
- UI input validation — test invalid inputs that a user can enter through the UI (e.g., out-of-range values in a numeric text field). These represent real failure paths at the system boundary and must be tested.
- Dependency error returns — whether to test error/failure paths from a dependency depends on its origin:
- Library or framework (external, not owned by this project) → test it; use a stub to inject the error condition.
- Game's own code (another component in this project) → skip; trust internal code correctness.
- Uncertain → use
AskUserQuestionto confirm with the user before designing test cases.
Testing randomness (PRNG-dependent SUT)
When the SUT consumes a pseudo-random number generator (UnityEngine.Random, System.Random, etc.), choose one of these strategies based on what the spec actually pins down:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/test-designing-guide/SKILL.md
Popularity
- Repository stars
- 20
- Repository forks
- 3
- 7-day trend score
- 15
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nowsprinting/unity-coding-skills/test-designing-guide)