nw-test-refactoring-catalog

Solid

Detailed refactoring mechanics with step-by-step procedures, and test code smell catalog with detection patterns and before/after examples

Testing & QA 526 stars 55 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
91
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Test Refactoring Catalog ## Test Code Smells (Full Detail) ### L1 Readability Smells #### Obscure Test - **Problem**: test name does not reveal business scenario being tested - **Detection**: generic names like Test1(), ProcessOrderTest(), or names requiring reading test body to understand - **Solution**: rename to Given_When_Then or should_do_expected_thing_when_condition format ``` Before: public void Test1() { /* ... */ } After: public void ProcessOrder_PremiumCustomer_AppliesCorrectDiscount() { /* ... */ } ``` #### Hard-Coded Test Data - **Problem**: magic numbers and strings obscure business rules being tested - **Detection**: numbers like 1000, 0.15, strings without explanation - **Solution**: extract to named constants that reveal business meaning ``` Before: Assert.Equal(850, result.Total); // What discount? After: const decimal EXPECTED_TOTAL = 1000 * (1 - 0.15m); Assert.Equal(EXPECTED_TOTAL, result.Total); ``` #### Assertion Roulette - **Problem**: multiple assertions without messages make failures unclear - **Detection**: multiple Assert.* calls without message parameter - **Solution**: add descriptive message to each assertion explaining expected business outcome ### L2 Complexity Smells #### Eager Test - **Problem**: single test verifies multiple unrelated behaviors - **Detection**: multiple arrange/act/assert cycles or assertions testing different concerns - **Solution**: split into focused tests, one per business scenario ``` Before: Proc...

Details

Author
nWave-ai
Repository
nWave-ai/nWave
Created
3 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Solid

nw-progressive-refactoring

Progressive L1-L6 refactoring hierarchy, 22 code smell taxonomy, atomic transformations, test code smells, and Fowler refactoring catalog

526 Updated 1 weeks ago
nWave-ai
Testing & QA Solid

testing-anti-patterns

Reviews test code to identify and fix common testing anti-patterns including flaky tests, over-mocking, brittle assertions, test interdependency, and hidden test logic. Flags bad patterns, explains the specific defect, and provides corrected implementations. Use when reviewing test code, debugging intermittent or unreliable test failures, or when the user mentions flaky tests, test smells, brittle tests, test isolation issues, mock overuse, slow tests, or test maintenance problems.

1,177 Updated today
rohitg00
Code & Development Solid

refactoring-patterns

Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", "technical debt", "move method", "inline variable", or "decompose conditional". Also trigger when cleaning up legacy code, preparing code for new features by restructuring, or identifying which transformation to apply to a specific code smell. Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code quality foundations, see clean-code. For managing complexity, see software-design-philosophy.

1,169 Updated 2 weeks ago
wondelai
Testing & QA Solid

test-anti-patterns

Quick pragmatic review of .NET test code for anti-patterns that undermine reliability and diagnostic value. Use when asked to review tests, find test problems, check test quality, or audit tests for common mistakes. Catches assertion gaps, flakiness indicators, over-mocking, naming issues, and structural problems with actionable fixes. Use for periodic test code reviews and PR feedback. For a deep formal audit based on academic test smell taxonomy, use exp-test-smell-detection instead. Works with MSTest, xUnit, NUnit, and TUnit.

3,219 Updated today
dotnet
Code & Development Solid

refactor

Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

34,233 Updated today
github