testing

Guide Unity package test workflows with TDD and NUnit patterns.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/punkfuncgames/tetris-clone --skill testing-punkfuncgames
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/punkfuncgames/tetris-clone/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/punkfuncgames/tetris-clone --skill testing-punkfuncgames

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This reference codifies a test-driven development workflow and testing standards for a modular Unity project to prevent regressions, false-green tests, and inconsistent test patterns across packages.

Core Features & Use Cases

  • TDD Mandate & Coverage: Requires writing tests first and driving toward 100% coverage for changes.
  • Framework Patterns: Provides NUnit, NSubstitute, UniTask, MessagePipe, and VContainer guidance and templates for EditMode and PlayMode tests.
  • Anti-patterns & Guardrails: Lists forbidden patterns (false greens, swallowing exceptions, changing expectations) and a decision flow for root-cause fixes.
  • Mock & Fixture Utilities: Describes MockFactory and TestFixtures helpers for creating common test doubles and ScriptableObject data.
  • Use Case: Use when adding or modifying package code to author tests first, validate behavior in CI, and eliminate flaky or misleading test results.

Quick Start

Add an EditMode test following the Test File Template, run the package Tests, and confirm the new test passes while avoiding forbidden workaround patterns.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up TDD workflows for Unity package tests to eliminate false-green tests?

To eliminate false-green tests in Unity package tests, enforce a test-first TDD workflow using NUnit and NSubstitute templates for EditMode and PlayMode suites, ensuring root-cause fixes and per-class coverage validation in CI.

What are the forbidden testing patterns in modular Unity UPM packages?

Forbidden testing patterns in Unity UPM packages include swallowing exceptions, changing test expectations to force passes, and other false-green workarounds. The testing infrastructure enforces guardrails and a decision flow to drive root-cause fixes instead of masking failures.

Does Unity testing infrastructure support NSubstitute mocking with UniTask compatibility?

Yes, Unity testing infrastructure supports NSubstitute mocking with UniTask compatibility. It provides MockFactory and TestFixtures utilities to create test doubles and ScriptableObject data while maintaining MessagePipe and VContainer framework pattern guidance.

How do I write EditMode and PlayMode test suites for Unity UPM packages?

Write EditMode and PlayMode test suites for Unity UPM packages by following the provided Test File Template, utilizing NUnit and NSubstitute frameworks, and validating behavior through CI pipelines to ensure 100% coverage for code changes.

Why do my Unity unit tests pass in CI but fail to catch regressions?

Unity unit tests may pass but miss regressions due to false-green patterns like swallowing exceptions or altering expectations. Enforcing strict TDD workflows, forbidden-pattern checks, and per-class coverage requirements eliminates these misleading test results.

What is the best way to achieve 100% test coverage for changes in modular Unity projects?

The best way to achieve 100% test coverage for changes in modular Unity projects is mandating test-first TDD practices, using NUnit and NSubstitute templates for EditMode and PlayMode tests, and validating all modifications through CI guardrails.