मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग5.8k · #14639

test-smell-detection

यह क्या करती है

यह स्किल टेस्ट स्मेल्स की एक औपचारिक, शोध-आधारित सूची के आधार पर टेस्ट की जाँच करती है। स्मेल्स वे पैटर्न हैं जिनसे टेस्ट पर भरोसा या उसे संभालना मुश्किल होता है। यह उन डेवलपर्स के लिए है जिन्हें अपने टेस्ट कोड की नामित और उद्धरण योग्य समीक्षा चाहिए।

कब इस्तेमाल करें

  • ✓जब आपको टेस्ट सूट में टेस्ट स्मेल्स की नामित और उद्धरण योग्य समीक्षा चाहिए।
  • ✓जब आप जानना चाहते हैं कि कौन-सी स्मेल श्रेणियाँ मौजूद हैं और वे कितनी गंभीर हैं।
  • ✓जब किसी प्रोजेक्ट के लिए औपचारिक, गंभीरता-क्रम वाला स्मेल आकलन माँगा गया हो।

Skill का लिंक

https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/test-smell-detection/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/test-smell-detection/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“हमारी टेस्ट फ़ाइलों की औपचारिक टेस्ट स्मेल समीक्षा दीजिए, जिसमें नामित श्रेणियाँ और हर खोज की गंभीरता लिखी हो।”

हर हफ़्ते 5 नई skills, 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-extensions catalog, 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

  1. 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.
  2. Read the tests and only verdict-changing production context.
  3. 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.
  4. Rank confirmed findings by risk of false confidence or flakiness, then by maintenance cost.
  5. 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, Pester Should -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
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills