← Back to list

testing
by dtbuchholz
⭐ 0🍴 0📅 Jan 22, 2026
SKILL.md
name: testing description: Apply test-driven development and testing best practices. Use this skill when writing tests, implementing TDD workflows, improving test coverage, or debugging failing tests. Covers unit, integration, and end-to-end testing patterns across languages.
Testing Best Practices
This skill provides guidance for writing effective tests and following test-driven development (TDD) practices.
When This Skill Applies
- Writing new tests for existing code
- Implementing features using TDD
- Improving test coverage
- Debugging or fixing failing tests
- Setting up testing infrastructure
Test-Driven Development (TDD)
Follow the Red-Green-Refactor cycle:
- Red: Write a failing test that defines expected behavior
- Green: Write the minimum code to make the test pass
- Refactor: Clean up the code while keeping tests green
TDD Benefits
- Forces clear thinking about requirements before implementation
- Produces testable, modular code by design
- Creates living documentation of expected behavior
- Catches regressions immediately
Test Structure
Use the Arrange-Act-Assert (AAA) pattern:
// Arrange: Set up test data and dependencies
// Act: Execute the code under test
// Assert: Verify the expected outcome
Naming Conventions
Test names should describe the scenario and expected outcome:
test_user_login_with_valid_credentials_returns_tokenshould throw error when email is invalidit("returns empty array when no items match filter")
Testing Pyramid
Balance your test suite:
- Unit Tests (70%): Fast, isolated, test single functions/methods
- Integration Tests (20%): Test component interactions, database, APIs
- E2E Tests (10%): Test complete user workflows, slowest but highest confidence
Best Practices
Do
- Test behavior, not implementation details
- Keep tests independent—no shared mutable state
- Use descriptive assertions with clear failure messages
- Mock external dependencies (APIs, databases, file systems)
- Test edge cases: null, empty, boundary values, errors
Don't
- Test private methods directly
- Write tests that depend on execution order
- Use production data in tests
- Ignore flaky tests—fix or remove them
- Over-mock to the point tests don't verify real behavior
Language-Specific Patterns
JavaScript/TypeScript
- Use Jest, Vitest, or Mocha for unit tests
- Use Testing Library for component tests
- Use Playwright or Cypress for E2E
- Mock with
jest.mock()orvi.mock()
Python
- Use pytest with fixtures for setup/teardown
- Use
unittest.mockorpytest-mockfor mocking - Use
pytest.mark.parametrizefor data-driven tests - Use
pytest-covfor coverage reports
Go
- Use table-driven tests with
t.Run() - Use
testifyfor assertions and mocks - Use
httptestfor HTTP handler tests - Run with
-raceflag to detect race conditions
Rust
- Use
#[cfg(test)]module for unit tests - Use
#[should_panic]for expected failures - Use
mockallcrate for mocking traits - Integration tests go in
tests/directory
Coverage Guidelines
- Aim for meaningful coverage, not 100%
- Focus on critical paths and complex logic
- Exclude generated code and configuration
- Use coverage to find untested code, not as a quality metric
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon