skb3002/agenthub/testing-patterns

Claude Code and agent skill by skb3002/agenthub

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Testing patterns and principles. Unit, integration, mocking strategies.

Install

npx vskill@latest install skb3002/agenthub/testing-patterns

SKILL.md

Testing Patterns

Principles for reliable test suites.

1. Testing Pyramid

/\ E2E (Few)
/ \ Critical flows
/----\
/ \ Integration (Some)
/--------\ API, DB queries
/ \
/------------\ Unit (Many)
Functions, classes

2. AAA Pattern

StepPurpose
ArrangeSet up test data
ActExecute code under test
AssertVerify outcome

3. Test Type Selection

When to Use Each
TypeBest ForSpeed
UnitPure functions, logicFast (<50ms)
IntegrationAPI, DB, servicesMedium
E2ECritical user flowsSlow
Framework Selection by Stack
StackUnit/IntegrationMockingHTTP Client
Node/TSVitest / Jestvi.mock / jest.mocksupertest
Pythonpytest (+ pytest-asyncio)unittest.mock / pytest-mockhttpx AsyncClient
Rustcargo testmockallreqwest
Gogo testgomock / testify/mockhttptest
FastAPI tip: Use asyncio_mode = "auto" in pyproject.toml so you don't need @pytest.mark.asyncio on every test.

4. Unit Test Principles

Good Unit Tests
PrincipleMeaning
Fast< 100ms each
IsolatedNo external deps
RepeatableSame result always
Self-checkingNo manual verification
TimelyWritten with code
What to Unit Test
TestDon't Test
Business logicFramework code
Edge casesThird-party libs
Error handlingSimple getters

5. Integration Test Principles

What to Test
AreaFocus
API endpointsRequest/response
DatabaseQueries, transactions
External servicesContracts
Setup/Teardown
PhaseAction
Before AllConnect resources
Before EachReset state
After EachClean up
After AllDisconnect

6. Mocking Principles

When to Mock
MockDon't Mock
External APIsThe code under test
Database (unit)Simple dependencies
Time/randomPure functions
NetworkIn-memory stores
Mock Types
TypeUse
StubReturn fixed values
SpyTrack calls
MockSet expectations
FakeSimplified implementation

7. Test Organization

Naming
PatternExample
Should behavior"should return error when..."
When condition"when user not found..."
Given-when-then"given X, when Y, then Z"
Grouping
LevelUse
describeGroup related tests
it/testIndividual case
beforeEachCommon setup

8. Test Data

Strategies
ApproachUse
FactoriesGenerate test data
FixturesPredefined datasets
BuildersFluent object creation
Principles
  • Use realistic data
  • Randomize non-essential values (faker)
  • Share common fixtures
  • Keep data minimal

9. Best Practices

PracticeWhy
One assert per testClear failure reason
Independent testsNo order dependency
Fast testsRun frequently
Descriptive namesSelf-documenting
Clean upAvoid side effects

10. Anti-Patterns

❌ Don't✅ Do
Test implementationTest behavior
Duplicate test codeUse factories
Complex test setupSimplify or split
Ignore flaky testsFix root cause
Skip cleanupReset state

Remember: Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3
7-day trend score
7

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/skb3002/agenthub/testing-patterns/badge)](https://verified-skill.com/skills/skb3002/agenthub/testing-patterns)

Something wrong with this skill or its page? Tell us.