assertion-quality
하는 일
이 스킬은 테스트 코드 안의 검증(assertion)을 검토하고, 그 검증이 얼마나 의미 있고 다양한지 평가합니다. 테스트가 실제로는 별로 확인하지 않으면서 통과한다고 의심하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓테스트가 값이 null이 아니거나 존재하는지만 확인하고 실제 결과는 확인하지 않을 때.
- ✓항상 참이거나 자기 자신을 참조하는 검증을 가진 테스트를 찾고 싶을 때.
- ✓테스트 스위트가 모두 통과하지만 실제 버그를 잡을지 확신이 없을 때.
스킬 링크
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/assertion-quality/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 테스트가 모두 통과하지만 많이 확인하는지 모르겠습니다. 검증이 얼마나 강한지 검토해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트가 테스트 코드와 테스트 대상 코드를 읽고, 각 검증이 무엇을 확인하는지 분류한 뒤, 약한 부분을 지표 요약과 함께 보고합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Assertion Diversity Analysis
Analyze test code in any supported language to measure how varied and meaningful the assertions are. Produce a metrics report that reveals whether tests verify different facets of correctness — not just "output equals X" but also structure, exceptions, state transitions, side effects, and invariants.
Language-specific guidance: Read the caller-provided or runtime-listed
test-analysis-extensionscatalog, then its matching language file (dotnet.md,python.md,typescript.md,go.md, etc.).test-analysis-extensionsis reference-only; do not invoke it as a skill. If the bundle is absent, use the pinned framework and this skill's rules, report the missing reference, and do not search installation directories.
Why Assertion Diversity Matters
Low assertion diversity signals shallow testing. Tests may pass while bugs hide in unasserted logic. Common symptoms:
| Problem | Symptom | Consequence |
|---|---|---|
| Trivial assertions | Test contains only Assert.IsNotNull(result) / assert result is not None / expect(x).toBeDefined() |
Test passes but doesn't verify correctness |
| Single-value obsession | Always check one field or return value | Bugs in unasserted logic slip through |
| No negative assertions | Never check what shouldn't happen | Regressions sneak in through false positives |
| No state checks | Don't verify object state changes | Missed side-effects or lifecycle issues |
| No structural checks | Only assert top-level value | Bugs in nested objects go unnoticed |
| Assertion-free tests | Tests that call but don't verify | Code coverage lies; false security |
When to Use
- User asks to evaluate assertion quality or depth
- User asks "are my tests actually testing anything meaningful?"
- User wants to know if test assertions are too shallow or trivial
- User asks for assertion coverage metrics or diversity analysis
- User suspects tests give false confidence despite passing
- The
test-engineeragent (or any test-generation workflow) calls this skill as a pre-completion self-review step on freshly generated tests, before declaring the run finished
When Not to Use
- User wants to write new tests (use
code-testingfor any language, orwriting-mstest-testsfor MSTest specifically) - User wants to detect anti-patterns beyond assertions (use
test-anti-patterns) - User wants to fix or rewrite assertions (help them directly)
- User asks about code coverage percentages (out of scope — this analyzes assertion quality, not line coverage)
Inputs
| Input | Required | Description |
|---|---|---|
| Test code | Yes | One or more test files or a test project directory to analyze |
| Production code | No | The code under test, to evaluate whether assertions cover the important behaviors |
Workflow
Step 1: Detect language and load extension
Identify the language and test framework. Read the corresponding file in
extensions/ relative to the supplied test-analysis-extensions catalog.
Use that catalog for other language filenames. Check only that known
directory when necessary; an unavailable reference changes the evidence limit,
not the workspace root or the requested review.
Step 2: Gather the test code
Read all test files the user provides. If the user points to a directory or project, scan for all test files using the markers in the language extension file (e.g., [TestMethod] for MSTest, def test_* for pytest, it() / test() for Jest, func TestXxx for Go).
Step 3: Classify every assertion
For each test method, identify all assertions and classify them into these language-neutral categories:
| Category | What it verifies | Examples across languages |
|---|---|---|
| Equality | Return value matches expected | Assert.AreEqual (MSTest), Assert.Equal (xUnit), assert x == y (pytest), expect(x).toBe(y) (Jest), assertEquals (JUnit), if got != want { t.Error... } / assert.Equal(t, want, got) (Go), x shouldBe y (Kotest), Should -Be (Pester), EXPECT_EQ (GoogleTest) |
| Boolean | Condition holds | Assert.IsTrue, assert flag (Python), expect(x).toBeTruthy() (Jest), assertTrue (JUnit), assert.True(t, ok) (testify), x.shouldBeTrue() (Kotest), Should -BeTrue (Pester), EXPECT_TRUE |
| Null / None / Nil | Presence/absence of value | Assert.IsNull (.NET), assert x is None (pytest), `ex |
자주 묻는 질문
약한 테스트를 고쳐 주나요?
아니요. 직접 수정은 다른 테스트 스킬이 다루며, 이 스킬은 분석 보고서를 만듭니다.
어떤 프레임워크를 다루나요?
MSTest, Jest, pytest, Go를 포함해 여러 가지를 다룹니다.
새 테스트를 쓰나요?
아니요. 새 테스트 케이스 작성은 별도의 테스트 스킬이 다룹니다.
상세 정보
작성자의 원본 설명
Analyze assertion quality, depth, variety, and false confidence in existing tests. ALWAYS USE when asked about weak, shallow, trivial, always-true, self-referential, assertion-free, presence/truthiness-only, or insufficiently diverse assertions, including MSTest, Jest, pytest, and Go. DO NOT USE for direct fixes: writing-mstest-tests owns supplied MSTest assertions; code-testing owns new cases. Use test-gap-analysis when asked whether tests would catch a production change, and test-anti-patterns for general severity-ranked audits.
repo: dotnet/skills
인기도
- GitHub 스타
- 5.8k
- 순위
- #14623
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
create-custom-agent
5.8k에이전트가 자체 도구, 지침, 다른 에이전트로의 핸드오프를 가진 VS Code 커스텀 에이전트 파일을 만들도록 돕습니다.
create-skill
5.8k에이전트가 올바른 이름, 명확한 트리거 설명, 표준을 따르는 SKILL.md 파일로 새 에이전트 스킬을 만들도록 돕습니다.
csharp-scripts
5.8k에이전트가 .NET 명령줄 도구로 작은 C# 프로그램을 전체 프로젝트 없이 단일 파일로 실행하도록 돕습니다.
dotnet-pinvoke
5.8k에이전트가 .NET에서 네이티브 C나 C++ 라이브러리를 올바르게 호출하도록 돕습니다. 시그니처, 문자열 처리, 메모리, 안전 핸들을 다룹니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.