본문으로 건너뛰기
Skillpedia
테스트5.8k · #14623

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/assertion-quality/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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-extensions catalog, then its matching language file (dotnet.md, python.md, typescript.md, go.md, etc.). test-analysis-extensions is 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-engineer agent (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-testing for any language, or writing-mstest-tests for 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬