test
Orchestration and guidance for backend testing changes, from unit and Orleans tests to host-level and commit discipline.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Orchestration and guidance for backend testing changes, from unit and Orleans tests to host-level and commit discipline.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.
Use when adding, editing, or reviewing source code comments. Guides Codex to write useful comments that explain why code is shaped a certain way, especially around non-obvious constraints, concurrency hazards, Orleans lifecycle rules, stream/outbox ordering, compatibility requirements, parsing loosely structured input, external standards, and workarounds.
| name | test |
| description | Orchestration and guidance for backend testing changes, from unit and Orleans tests to host-level and commit discipline. |
This skill is an orchestrator for backend test changes. Use sibling docs on demand depending on the task.
Tests validate behavior through public interfaces and should be resilient to internal refactors. Prefer integration-style tests with real components and hand-built fakes only at true boundaries (HTTP clients, storage, time, randomness).
In this repo, Orleans tests usually exercise real grains through a test cluster and let an IGrainActivityCollector observe asynchronous follow-up work.
See tests.md for examples and fakes.md for boundary rules.
Adding a test?
├── Production code does not yet exist → TDD → see [tdd-workflow.md](tdd-workflow.md)
└── Production code already exists → test-after → see [test-after.md](test-after.md)
Setting up test data?
├── 1–2 trivial params → raw constructor
├── Reused shape / non-trivial setup → builder → see [builders.md](builders.md)
└── External boundary (HTTP/storage/time/randomness) → fake → see [fakes.md](fakes.md)
Test target is an Orleans grain?
├── Grain implements observer/event method directly → direct call, then assert
├── Asynchronous path via stream/one-way/timer/reminder → WaitForAssertionAsync
└── Need low-level operation traces → collector feeds
→ see [orleans.md](orleans.md)
About to run tests or commit?
├── Both src/ and test/ changed since last green run → re-run, see [commit-discipline.md](commit-discipline.md)
└── Every commit green → ship
These are properties, not hard rules.
[Fact] / [Theory], TestContext.Current.CancellationToken, and IClassFixture<T>/shared fixtures for heavy setup.foreach, if/else, try/finally, switch, and LINQ with side effects are red flags.Add_item_to_empty_shopping_cart, not Test1.ManualTimeProvider when time is part of behavior. Deterministic time wins.OrderId, CustomerId).Assert extensions in an appropriate test utility namespace.WaitForAssertionAsync only for async boundaries.test/<Project>.Tests/<Folder>/<Class>Tests.cs ↔ src/<Project>/<Folder>/<Class>.cs).| Topic | File |
|---|---|
| Red-green-refactor for new code | tdd-workflow.md |
| Validation cycle for tests on existing code | test-after.md |
| Good vs bad tests and naming | tests.md |
| Hand-built fakes | fakes.md |
| Fluent domain builders | builders.md |
| Orleans grain testing | orleans.md |
| End-to-end / host-level tests | e2e.md |
| Parallelism and fixture isolation | parallelization.md |
| Commit discipline and green-state commits | commit-discipline.md |
| Refactor triggers | refactoring.md |
| Interface design for testability | interface-design.md |
Use solution-level commands when possible:
dotnet test <solution>.slnxdotnet test <test-project>.csprojdotnet test --filter "FullyQualifiedName~MyClassTests"-- RunConfiguration.TestSessionTimeout=30000 (where supported)Use dotnet verify:
dotnet verify reviewdotnet verify acceptdotnet verify rejectCommit only .verified.* files.