
snapshot-unit-testing
by dmytroett
Register your services in IoC container in AOP style.
SKILL.md
name: snapshot-unit-testing description: Write or update unit (not integration) tests in this repo, use Verify snapshot testing for source generator output, and run/accept snapshots via the provided scripts.
Scope
Locate unit tests under test/*UnitTests. Use Verify snapshots when validating generated output; prefer normal assertions for non-generator logic.
Principles
Favor a small number of representative scenarios; combine related assertions to minimize snapshot files even if individual tests are larger.
Avoid opening or reading .received/.verified files; rely on dotnet test output and VerifyException details only.
Treat .codex/skills/snapshot-unit-testing/scripts/accept-snapshot and .codex/skills/snapshot-unit-testing/scripts/accept-all-snapshots as black boxes; do not open or inspect them.
Workflow
Write or update the test based on a concrete scenario.
Run targeted tests with dotnet test --filter and add --no-build/--no-restore when appropriate.
Inspect dotnet test output to decide whether the test logic is wrong or snapshots need updating; do not open raw snapshot files.
Accept snapshots only when the behavior change is intended and clearly understood:
- Use
.codex/skills/snapshot-unit-testing/scripts/accept-snapshot <TestClassName> <TestMethodName>for a single test. - Use
.codex/skills/snapshot-unit-testing/scripts/accept-all-snapshotsfor bulk updates. - Skip these scripts for non-snapshot tests.
Re-run tests and iterate until they pass.
Commands
- Run a single test:
dotnet test --filter "FullyQualifiedName~<TestClass>.<TestMethod>"
- Accept one snapshot:
.codex/skills/snapshot-unit-testing/scripts/accept-snapshot.ps1 <TestClassName> <TestMethodName>
- Accept all snapshots:
.codex/skills/snapshot-unit-testing/scripts/accept-all-snapshots.ps1
Verify failure pattern
Use the failure output only; do not open the files listed.
VerifyException : Directory: /home/me/projects/AttributedDI/test/AttributedDI.SourceGenerator.UnitTests/Snapshots
NotEqual:
- Received: AddAttributedDiTests.GeneratesAddAttributedDiForEntryPoint.DotNet9_0.received.txt
Verified: AddAttributedDiTests.GeneratesAddAttributedDiForEntryPoint.verified.txt
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です