test-smell-detection
하는 일
이 스킬은 테스트를 더 믿기 어렵거나 유지보수하기 어렵게 만드는 패턴, 즉 테스트 냄새를 공개된 분류 체계를 사용해 감사합니다. 테스트 코드에 대해 이름이 붙고 인용할 수 있는 검토를 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓테스트 스위트에서 이름이 붙은 테스트 냄새를 검토해야 할 때.
- ✓어떤 테스트 냄새 범주가 나타나는지, 그리고 얼마나 심각한지 알고 싶을 때.
- ✓프로젝트에 대해 공식적이고 심각도 순으로 정리된 냄새 평가가 요청되었을 때.
스킬 링크
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/test-smell-detection/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 테스트 파일에 대한 공식 테스트 냄새 검토를 해 주세요. 이름이 붙은 범주와 각 발견 사항의 심각도를 알려 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트가 테스트를 읽고, 각 후보를 이름 있는 냄새 범주와 대조하면서 코드를 증거로 사용하고, 확인된 발견 사항을 심각도 순으로 정렬합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Test Smell Detection
Audit test code with the academic taxonomy, code evidence, calibrated framework idioms, and fixes native to the codebase.
Scope
- Audit only staged or named tests. Search the current workspace before asking for code; never claim a file is missing until that search finds no relevant test.
- Read production code only when it changes a verdict.
- For unfamiliar framework APIs, read the matching language file relative to
the caller-provided or runtime-listed
test-analysis-extensionscatalog, not a skill invocation. If absent, use the framework and rules here and report the missing reference; do not search installation directories. - Read the complete catalog when the caller requests all 19 smells, asks for citations, or the code may contain a smell outside the high-signal set below. Do not load it for a narrow question that this file answers.
Audit Workflow
- Search for and read the staged tests; detect language, framework, boundaries, and integration markers. This is the first action even when no path is named.
- Read the tests and only verdict-changing production context.
- For each candidate, verify the executed check, choose the formal category, calibrate, then assign severity. Report proven non-catalog test-validity defects separately; do not relabel them as smells.
- Rank confirmed findings by risk of false confidence or flakiness, then by maintenance cost.
- Give a framework-correct replacement for each actionable finding. Never use .NET terminology or APIs in another ecosystem.
High-Signal Decisions
| Evidence | Academic finding | Do | Never |
|---|---|---|---|
Assertion behavior changes behind if, switch, or branching loops |
Conditional Test Logic | Split cases or parameterize them | Flag table-driven or parametrized tests merely because a runner loop exists |
| A test relies on an undeclared file, network service, environment value, or database | Mystery Guest or Resource Optimism | Make the dependency explicit and hermetic; distinguish the two using the full catalog | Condemn an integration test merely for exercising its declared real resource |
| Fixed wall-clock sleep waits for an outcome | Sleepy Test | Await or poll the condition with a timeout | Downgrade it only because the test is an integration test |
| Executable test has no assertion, expected-exception marker, or mock verification | Unknown Test | Assert the observable outcome | Call an empty body Unknown Test; the formal name is Empty Test |
| Async assertion/coroutine is created but not awaited or returned | Critical non-catalog false-pass defect | Report it separately and show the required await/return |
Force it into Unknown Test; the assertion statement exists |
| One test exercises many unrelated production behaviors | Eager Test | Separate behavior-focused tests | Flag a deliberate end-to-end workflow without considering its scope |
| Expected numeric literal has no local meaning | Magic Number Test | Name the domain value or derive it from setup | Flag count == 3 immediately after adding three items |
Assertion depends on ToString, repr, description, or display formatting that is not the contract |
Sensitive Equality | Assert stable fields or use a structural matcher | Flag a test whose explicit contract is the formatted string |
| Test manually manages expected exception flow | Exception Handling | Use the framework's exception assertion and check meaningful details | Claim a capture-and-assert test verifies nothing |
| Shared setup creates state irrelevant to the tests that receive it | General Fixture | Remove unused state or narrow the fixture; rank cheap state low | Condemn relevant shared setup merely because it is shared |
| Test is disabled or skipped | Ignored Test | Report every skip, but rank a tracked, reasoned skip below an unexplained one | Clear a skip because its reason is good, or give both the same urgency |
Calibration Rules
Apply these before assigning a finding:
- Mock-call verifications, snapshots, bare pytest
assert, PesterShould -Invoke, and expected-exception constructs are assertions. - A literal or snapshot assertion may expose a coverage gap, but is not Unknown Test or another smell without separate evidence.
- Count assertion statements. One assertion is never Assertion Roulette; missing messages alone are not a smell.
- Same-method tests are not Lazy Test when the
자주 묻는 질문
냄새의 이름은 어디서 왔나요?
Assertion Roulette, Conditional Test Logic, Mystery Guest 같은 공개된 테스트 냄새 분류 체계에서 왔습니다.
냄새를 고치나요?
발견 사항을 보고하고, 코드베이스에 맞는 수정 방법을 제안합니다.
일반적인 안티 패턴 검토와 같은 건가요?
아니요. 공식 분류 체계를 쓰므로, 일반적인 검토보다 이름 있는 범주가 필요할 때 가장 알맞습니다.
상세 정보
작성자의 원본 설명
Audits existing tests in any language using formal, research-backed test smell names and the testsmells.org 19-smell academic taxonomy. Use when the caller asks for an academic or citable test-smell review, named smell categories, or a formal severity-ranked smell assessment. Covers Assertion Roulette, Conditional Test Logic, Mystery Guest, Eager Test, Sleepy Test, Unknown Test, Sensitive Equality, and the rest of the catalog across .NET, Python, JavaScript/TypeScript, Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, and C++. DO NOT USE FOR a quick pragmatic test review (use test-anti-patterns
repo: dotnet/skills
인기도
- GitHub 스타
- 5.8k
- 순위
- #14639
- 라이선스
- 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 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.