agentleFS
sefaertuncsefaertunc/Worclaude/.claude/skills/testing/SKILL.md

testing

Skill4 starsChanged 7 months agoMITView on GitHub

Test philosophy, coverage strategy, test-first patterns, what to test and what not to

123 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use oss-pr, pr-automation and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • CES-LtdSkill

    oss-pr

    Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.

    Also in 3 projects that use this

  • CES-LtdSkill

    pr-automation

    PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    cicd

    Continuous integration and delivery pipelines

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    networking

    Practical application and coding skills for Networking

    Also in 3 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 9 projects that use this

  • Cogni-AI-OUSkill

    dotfiles

    Reference for repository dotfiles, including their purposes, standard configurations, and usage guidelines. You MUST load this skill when configuring, troubleshooting, or understanding repository dotfiles.

    Also in 3 projects that use this

  • +2 more from CES-Ltd
  • +1 more from ffsshhttiikk

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 13 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 105 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test behavior, not implementation.

    line 17
  2. Distinctive:

    Every function has these potential edge cases.

    line 43
  3. Distinctive:

    When doing test-first: write the test, watch it fail, implement the minimum to pass, then refactor.

    line 69
  4. Distinctive:

    Keep tests independent. No test should depend on another test running first.

    line 87
  5. Distinctive:

    No shared mutable state between tests.

    line 88
  6. Distinctive:

    Test names should read like specifications:

    line 92
  7. Distinctive:

    Use sparingly and review snapshot diffs carefully.

    line 105
  8. Distinctive:

    Mock everything: if your test mocks 5 dependencies, you're testing the mocking framework, not your code.

    line 106
  9. Distinctive:

    Test the framework: don't test that Express routes requests or that React renders components.

    line 108
  10. Distinctive:

    Slow tests without reason: if a test takes seconds, it's probably doing I/O that should be mocked or it's an integration test that should …

    line 112
  11. Distinctive:

    Test data should be self-contained.

    line 119
  12. Distinctive:

    When a test fails, the test might be wrong.

    line 121
  13. Distinctive:

    Delete tests that test deleted features.

    line 123

“Common” is measured: kept by at least 6 in 10 of the 105 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Testing

What to Test

Test behavior, not implementation. A test should verify what a function does, not how it does it. If you refactor the internals and the test breaks, the test was testing the wrong thing.

Good test: "given a valid email, returns true" Bad test: "calls regex.match with pattern /^[a-z].../"

Meaningful Coverage vs Line Coverage

100% line coverage is a vanity metric. You can have 100% coverage and still ship bugs if your tests don't exercise meaningful paths.

Focus coverage on:

  • Business logic (the rules that make your app unique)
  • Error handling paths (what happens when things go wrong)
  • Boundary conditions (empty, null, max values, off-by-one)
  • Integration points (where your code meets external systems)

Skip coverage on:

  • Simple getters/setters
  • Framework boilerplate
  • Generated code
  • Pure delegation (functions that just call another function)

Edge Cases Worth Testing

Every function has these potential edge cases. Consider which apply:

  • Null / undefined / empty string
  • Empty array / empty object
  • Single element
  • Very large input
  • Negative numbers / zero
  • Unicode and special characters
  • Concurrent access
  • Network timeout / failure

You don't need to test ALL of these for every function. Think about which ones are realistic for your specific case.

Test-First Workflow

Writing tests first helps when:

  • The behavior is well-defined but the implementation isn't clear
  • You're fixing a bug (write the failing test first, then fix)
  • You're implementing a spec (tests become the spec's executable form)

Test-first hurts when:

  • You're exploring and don't know what the API should look like
  • You're prototyping and will throw the code away
  • The test would be trivial (testing that a constant equals itself)

When doing test-first: write the test, watch it fail, implement the minimum to pass, then refactor. Don't write all the tests up front — go one at a time.

Test Structure

Follow Arrange-Act-Assert (AAA):

// Arrange: set up the test conditions
const input = createValidInput();

// Act: call the thing being tested
const result = processInput(input);

// Assert: verify the outcome
expect(result.status).toBe('success');

Keep tests independent. No test should depend on another test running first. No shared mutable state between tests.

Naming Tests

Test names should read like specifications:

  • "should return 401 when token is expired"
  • "should merge arrays without duplicates"
  • "should create backup directory if it doesn't exist"

Not:

  • "test1"
  • "it works"
  • "handles edge case"

Testing Anti-Patterns

  • Snapshot abuse: snapshots test that output didn't change, not that it's correct. Use sparingly and review snapshot diffs carefully.
  • Mock everything: if your test mocks 5 dependencies, you're testing the mocking framework, not your code. Prefer integration tests for heavily-connected code.
  • Test the framework: don't test that Express routes requests or that React renders components. Trust the framework; test YOUR logic.
  • Brittle assertions: asserting on exact error messages or full object shapes when only one field matters. Assert on what matters.
  • Slow tests without reason: if a test takes seconds, it's probably doing I/O that should be mocked or it's an integration test that should be tagged separately.

Gotchas

  • Flaky tests are worse than no tests. They erode trust in the entire suite. Fix immediately or quarantine with a clear TODO.
  • Test data should be self-contained. Don't rely on database state, external services, or file system artifacts from other tests.
  • When a test fails, the test might be wrong. Don't assume the code is broken — read the test carefully first.
  • Delete tests that test deleted features. Orphan tests confuse and mislead.
  • Async tests need proper awaiting. An unawaited assertion silently passes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.