/google-engineering:google-testingfrom google-engineering
Google's testing discipline — test sizes and scopes, the 80/15/5 mix, testing behaviors not methods, DAMP over DRY, preferring real implementations over mocks, and avoiding brittle change-detector tests. Use when writing or reviewing any test, deciding what to test or at what level, choosing between a real object, a fake, and a mock, debugging a flaky or brittle test, or judging whether a change has adequate test coverage. From Software Engineering at Google and Testing on the Toilet.
Ships in google-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Tests exist so the system can be changed safely. That is the whole justification: a test's value is measured by the future changes it makes safe, not by the lines it covers today.
The Beyoncé Rule — if you liked it, you should have put a test on it. Any behavior you don't want broken needs a test. If it isn't tested, the next person is free to break it and CI will agree with them.
Tests ship in the same change as the code they cover. A change that alters logic without touching tests is incomplete.
Size is about resources and determinism, not about how much code runs. Enforce it — it's what keeps a suite fast and non-flaky.
| Size | Allowed |
|---|---|
| Small | Single process. No sleeping, no I/O, no blocking calls. No network, no disk. Heavyweight dependencies replaced with test doubles. |
| Medium | Multiple processes, threads, blocking calls, network calls to localhost only. Single machine. |
| Large | Everything above plus multi-machine. Reserved for genuine end-to-end validation. |
Most tests should be small. Small tests are fast and deterministic, so they can run on every change; large tests are slow and flaky, so they run rarely and catch problems late.
Never sleep() in a test. Inject a fake clock, or wait on a real condition. A sleep is either flaky or slow, usually both.
Different axis from size. Narrow = one class or method. Medium = a few components interacting. Broad = a large slice or emergent system behavior.
Target mix: ~80% narrow unit tests, ~15% medium integration tests, ~5% end-to-end. Shape varies by product, but an hourglass — many unit, many E2E, nothing between — means integration bugs get caught slowly and expensively. An ice cream cone (mostly E2E) means a slow, flaky suite nobody trusts.
One method often has many behaviors, and one behavior often spans methods. Structure tests around behaviors — a behavior is given some state, when an action occurs, then some outcome.
// Method-driven: one bloated test that fails for a dozen unrelated reasons.
test('processTransaction', ...)
// Behavior-driven: each failure names its own cause.
test('transfer fails when the source account has insufficient funds', ...)
test('transfer records a timestamped entry in both ledgers', ...)
Name the test after the behavior, not the method under test. When it fails, the name alone should tell you what broke — a good name means you rarely have to open the test to understand a failure.
Keep one behavior per test. Assertions should be narrow: assert the specific thing the behavior promises, not a full object dump. Broad assertions fail for reasons unrelated to what's being tested.
Write clear failure output. The message should say what was expected, what happened, and enough context to act — not expected true, got false.
Production code is DRY. Test code is DAMP — Descriptive And Meaningful Phrases. Duplication in tests is often good, because a test must be readable in isolation without chasing helpers and shared setup up the file.
Prefer explicit, literal construction over shared fixtures and clever factories. Where a helper genuinely helps, it should make the relevant values more visible, not hide them:
// Hides the thing the test is about.
const user = createTestUser();
// Names the thing the test is about, defaults the rest.
const user = newUser().withBalance(0).build();
DRY still applies to mechanical setup that carries no meaning for the test.
Test the unit the way its callers use it. "Unit" means a reasonable public surface, not necessarily one class — testing every private helper directly is how suites become impossible to refactor.
Don't test implementation details. A test that asserts how something is done rather than what it produces is a change-detector test: it fails on every refactor, never catches a real bug, and its only signal is "the code changed" — which you already knew. Change-detector tests cost more than they return; delete them.
The check: if I rewrite the internals but keep the behavior, does this test still pass? If no, it's testing the wrong thing.
Order of preference:
Why mocks are the last resort: a mocked collaborator can't tell you it changed. Mock client(url, {data}), and when the real client switches to {body}, the test still passes and production breaks. The test is now asserting a contract that no longer exists. Heavy mocking also couples the test to the call sequence, so any refactor rewrites the tests.
Rules:
verify everything and your test breaks on every unrelated change.For HTTP specifically: intercept at the network boundary with a mock server rather than stubbing your HTTP client — you keep the client's real behavior (URL construction, headers, serialization, error handling) in the test path. See react-testing for the JS/TS version of this.
Coverage is a diagnostic, not a goal. High coverage with change-detector tests is worse than moderate coverage with behavior tests. Ask "what behavior would break silently?" — not "what line is uncovered?"
Tests are code that must be maintained; hold them to the same bar. When reviewing:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub fishnos/claude-config --plugin google-engineering5 skills in this plugin
/git-workflowIndustry-standard version control — atomic commits, commit message anatomy, Conventional Commits, git trailers, branching models, rebase vs merge, PR hygiene, SemVer, changelogs, tags, signing, and history-recovery. Use before writing any commit message, when splitting work into commits, when choosing a branch strategy or merge method, when versioning or releasing, when a rebase/merge/force-push decision comes up, or when history needs repairing. Carries the Conventional Commits, SemVer, and Keep a Changelog specs in references/./google-cl-authorAuthor changes the way Google expects them — one self-contained change per commit/PR, tests in the same change, a description that says what and why, and collaborative responses to review feedback. Use when planning how to split work into commits or PRs, writing a commit message or PR description, deciding whether a change is too big, or responding to review comments. Encodes google/eng-practices CL author guide./google-code-reviewReview code the way Google reviews a CL — design first, then functionality, complexity, tests, naming, comments, style, consistency, documentation, every line. Use whenever reviewing a diff, PR, branch, or file someone (including you) just wrote; whenever asked to "review", "check", "look over", "critique", or "audit" code; and as a self-review pass before reporting any implementation as done. Encodes google/eng-practices reviewer guide./google-styleGoogle's language style guides — TypeScript, JavaScript, HTML/CSS, Python, Shell, Go, Java, C++, C#, Objective-C — as the authority on formatting, naming, comments, and language-feature use. Use before writing or editing code in any of these languages, when reviewing style in a diff, when naming things, when deciding whether a language feature is allowed, or when a style disagreement needs an authority. Carries the full text of each guide in references/.