Mandatory TDD/BDD Testing Strategy

VerifiedSafe

Enforces a TDD/BDD testing strategy using describe/it syntax, requiring tests to be written before code and coverage ≥80%. Helps maintain code reliability and catch regressions by running tests locally before every commit.

Sby Skills Guide Bot
TestingIntermediate
1606/2/2026
Claude Code
#tdd#bdd#testing-strategy#test-coverage#test-first

Recommended for

Our review

This skill enforces a mandatory TDD/BDD testing strategy with actual test execution and coverage verification before commits.

Strengths

  • Ensures at least 80% code coverage
  • Uses clear, readable BDD syntax
  • Requires real test execution with output evidence
  • Promotes deterministic and fast tests

Limitations

  • May slow down initial development iterations
  • Requires strict team discipline
  • Does not cover complex UI testing
When to use it

When building production-critical features where reliability and regression prevention are paramount.

When not to use it

During rapid exploration or prototyping phases where requirements are unclear and change often.

Security analysis

Safe
Quality score80/100

The skill instructs running standard test commands (pytest, npm test) and does not contain destructive, exfiltrating, or obfuscated instructions. No external payloads, no disabling of safety measures. Execution of tests is a normal development activity.

No concerns found

Examples

BDD test for login
Write a BDD test for the login feature before implementing the actual login logic. Use describe/it syntax and test that a valid user can log in with correct credentials.
Run tests with coverage
Run the existing test suite with coverage reporting for the backend Python code using pytest with --cov=app, then show the test execution output and confirm coverage is at least 80%.
Add TDD tests for new endpoint
Create failing tests for a new API endpoint /api/users that returns a list of users. Then implement the endpoint to make the tests pass, ensuring all tests run successfully with ≥80% coverage.

Mandatory TDD/BDD Testing Strategy

Core Principles

  • BDD Style: describe/it syntax for tests
  • Test-First: Write failing tests before implementation
  • Deterministic: Use data-testid, role, label selectors
  • Fast & Light: Prefer unit/integration tests

Example BDD Structure

describe('Calculator', () => {
  it('adds two positive numbers', () => {
    expect(add(5, 7)).to.equal(12);
  });
});

Mandatory Test Execution

Requirements

  1. Actually run test suite with coverage
  2. Confirm all tests pass
  3. Verify ≥80% coverage
  4. Include test execution output

Backend (Python)

python3 -m pytest tests/ -v --cov=app --cov-report=term-missing

Frontend (TypeScript)

npm test -- --coverage

Evidence Requirement

## Test Execution Evidence
### Command:
`pytest tests/test_showcase_videos.py -v --cov=app.api`

### Output:
20 passed in 3.42s
Coverage: 87%

Enforcement

  • MANDATORY with NO EXCEPTIONS
  • Tests run LOCALLY before commit
  • Test output in PR descriptions
  • Actual coverage percentages required

Violation Consequences

  • Broken code in production
  • Undetected bugs
  • Loss of test suite confidence

Reference

  • references/bdd-patterns.md
  • references/coverage-requirements.md
Related skills