testing-infrastructure

Create test worlds and mock ECS dependencies for Unity systems.

23|17|Updated Apr 16, 2023
One-click install
npx skills add https://github.com/decentraland/unity-explorer --skill testing-infrastructure-decentraland
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-infrastructure
Source: https://github.com/decentraland/unity-explorer/tree/main/.claude/skills/testing-infrastructure
Command: npx skills add https://github.com/decentraland/unity-explorer --skill testing-infrastructure-decentraland

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and utilities for writing robust and efficient tests for Unity's Entity Component System (ECS), ensuring the stability and reliability of your game or application logic.

Core Features & Use Cases

  • Test Base Classes: Utilize UnitySystemTestBase<TSystem> for streamlined ECS system testing with automatic world and system lifecycle management.
  • Mocking Utilities: Employ ECSTestUtils for creating mock dependencies like ISceneData with NSubstitute.
  • Test Type Guidance: Understand when to use EditMode vs. PlayMode tests and how to structure your test assemblies and code.
  • Use Case: When developing a new ECS system that interacts with scene data, use this Skill's utilities to set up a test environment, mock the ISceneData interface, and write focused tests for your system's logic in EditMode.

Quick Start

Use the testing-infrastructure skill to set up a test world for an ECS system named MyCustomSystem.

Frequently Asked Questions about testing-infrastructure

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

FAQPage Schema
How do I write unit tests for Unity ECS systems?

Use the UnitySystemTestBase<TSystem> base class to write Unity ECS unit tests, which provides automatic world creation and system lifecycle management while mocking dependencies with NSubstitute and ECSTestUtils.

What is the difference between EditMode and PlayMode tests in Unity ECS?

EditMode tests in Unity ECS run fast without rendering overhead, suitable for isolated system logic verification, while PlayMode tests execute within the Unity player loop, necessary for testing asynchronous operations and system lifecycle behaviors.

How do I mock scene data dependencies in Unity ECS tests?

Mock scene data dependencies in Unity ECS tests by using ECSTestUtils to create mock interfaces like ISceneData with NSubstitute, allowing you to isolate and verify system logic without actual scene loading.

Can I test asynchronous operations in Unity ECS using NUnit?

Yes, you can test asynchronous operations in Unity ECS using NUnit by leveraging UnitySystemTestBase and test world infrastructure to verify system lifecycles and asynchronous execution within EditMode or PlayMode.

How do I set up a test world for an ECS system?

Set up a test world for an ECS system by inheriting from UnitySystemTestBase<TSystem>, which automatically handles test world creation and system lifecycle management, enabling focused dependency mocking and logic verification.