AgentSkillsCN

mythosmud-test-writing

编写并运行MythosMUD的测试用例:服务器端测试位于server/tests/unit|integration,客户端测试位于client;仅需在项目根目录下运行make test或make test-comprehensive。适用于新增测试用例、解读测试失败原因,或当用户询问测试布局与覆盖率时使用。

SKILL.md
--- frontmatter
name: mythosmud-test-writing
description: Write and run MythosMUD tests: server tests under server/tests/unit|integration, client under client; use make test or make test-comprehensive from project root only. Use when adding tests, interpreting test failures, or when the user asks about test layout or coverage.

MythosMUD Test Writing

Where Tests Live

AreaLocationNotes
Server unitserver/tests/unit/By module, e.g. server/tests/unit/events/
Server integrationserver/tests/integration/Cross-component tests
Clientclient/Per project structure (e.g. __tests__ next to source)
Fixtures/utilitiesserver/tests/fixtures/Mixins, helpers only — not test classes

How to Run Tests

  • Always from project root. Never run tests from server/ or client/ as the sole working directory.
  • Never use python -m pytest from server/; use the Makefile from project root.
GoalCommand
Fast suite (unit + critical integration)make test
Full suite (all tests, including slow)make test-comprehensive or make test-ci
Server onlymake test-server
Server with coveragemake test-server-coverage
Client onlymake test-client
Client with coveragemake test-client-coverage
All with coveragemake test-coverage

Coverage

  • Minimum: 70% overall for new code.
  • Critical code: 90% (security, core features, user-facing code).

Rules

  • Tests must test server/client code, not test infrastructure or Python built-ins.
  • When a bug is fixed, add or extend a test that would have caught it.
  • Exclude test_player_stats.py from coverage as per project config.

Reference