Логотип Testing On The Toilet

Testing On The Toilet

Спільнота
shamashel
testing-on-the-toilet

Apply Google Testing on the Toilet (TotT) rules when writing tests, reviewing a test diff, choosing mocks vs fakes, diagnosing brittle or change-detector tests, DAMP vs DRY test structure, SMURF/pyramid layer choice, or flaky time/sleep/shared-fixture tests. Instructs what a good test asserts and what to refuse. Not a Vitest/runner cookbook and not an E2E authoring workflow.

Огляд

Видавецьshamashel
Репозиторійtesting-on-the-toilet
Назва навичкиtesting-on-the-toilet
Зірки
36
Форки
0
Файли в пакеті
1
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 1

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Видавець на GitHub: shamashel. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Testing On The Toilet у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/shamashel/testing-on-the-toilet/tree/main/skills/testing-on-the-toilet
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/shamashel/testing-on-the-toilet.git /tmp/testing-on-the-toilet
mkdir -p .claude/skills
cp -r /tmp/testing-on-the-toilet/skills/testing-on-the-toilet .claude/skills/testing-on-the-toilet
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Testing On The Toilet в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Testing On The Toilet, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Testing On The Toilet не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Testing on the Toilet

Distilled from Google's Testing on the Toilet episodes (2007–2026). Episode index: references/episodes.md.

Run this loop on every new test and every test you review. Completion: each test that ships would fail on a real behavior bug and would survive a behavior-preserving refactor.

1. Change-detector gate

A change-detector restates production structure (especially ordered verify of every collaborator call) without checking an observable result. Correct and incorrect implementations pass equally; any rename/extract/reorder fails the suite.

Rewrite it to assert state, return value, rendered output, or persisted data. If you cannot name the user-visible contract, delete the test and say why. Do not "fix" a refactor by mechanically updating fifty mirrors.

Interaction verify is allowed only when the call itself is the contract (send mail once, do not double-charge, presenter tells the view to show X). If unsure, rewrite to a state/return assertion; if that is impossible, stop and ask which observable outcome the test protects.

2. Pick the cheapest layer that still has fidelity

Name the bug/risk first. Pick the topmost row in the table that can catch it. Escalate a row only when a cheaper layer would miss that risk (state the miss). SMURF (Speed, Maintainability, Utilization/cost, Reliability, Fidelity) is the tradeoff language when two rows could both catch it: prefer the cheaper/faster/more reliable one.

RiskLayer
Pure logic, parsing, validation, reducersFast unit through the public API
Collaborators you own, in-processReal objects or an owner-maintained fake
Service/HTTP contractOwner fake or hermetic server — not a handwritten request mock
UI wiring (disabled, unbound, hidden)Drive the rendered control (click/type), not the handler
Cross-system critical pathTiny e2e set: one path per use case plus key error classes; assert system outcomes, not copy/layout

Brainstorm key risks before stacking layers. Coverage meters find gaps; they do not certify quality. Cover both sides of a branch (the implicit else counts). Skip exhaustive combinatorics; extract predicates and cover each independently.

Prefer testing through the public API. Exhaustive tests of private helpers for inputs callers never pass are change-detectors in disguise.

3. Choose the double

Order: real → fake → stub → mock. Mock last.

  • Real when it is fast, deterministic, in-process.
  • Fake: simplified working impl of a type you (or the library owner) maintain. Keep it narrow. Contract-test fake vs real when the fake is shared.
  • Stub: canned returns for queries. Do not verify getters.
  • Mock: verify side-effecting calls whose interaction is the spec.

Hard rules:

  • Do not mock types you don't own. Wrap the third-party API; mock the wrapper; test the wrapper against the real library.
  • Mocking more than one or two collaborators, or a long when/verify chain, is a seam smell — extract a narrower port and fake that.
  • Inject long-lived collaborators in the constructor; pass per-call work as method arguments. No hidden singletons, unmockable statics, or now() inside the logic under test.

4. Author the test (DAMP)

DAMP (descriptive and meaningful phrases) beats DRY in tests. Tests have no tests — a reader must see cause next to effect in the method body.

  • One behavior per test. Name unit_scenario_expectedOutcome (or the project's equivalent). testFoo is not a name.
  • Arrange–act–assert in one block. Shared @Before soup that lives far from the assertion is how wrong expected values sneak in.
  • Helpers hide irrelevant construction. Scenario-relevant fields stay visible in the test. Builder/factory with defaults is good; silently asserting a helper default is not.
  • Literal inputs and expected outputs. Do not compute the expectation with loops/conditionals that can share a bug with production. If a helper must contain logic, unit-test the helper.
  • Narrow assertions: the fields under test, not the whole object/screenshot/hash order. One full-equality check for the common happy object is enough.
  • Distinct non-default values per input (0, "", first enum can match uninitialized state and fake a pass).
  • Actionable failures: precise matchers (containsEntry, isOk with error text) over assertTrue(result.ok()). Independent checks should continue (EXPECT) unless later asserts are meaningless (ASSERT file opened).
  • Floats: tolerance, never exact equality.
  • UI locators: stable test IDs, not copy or brittle XPath.

5. Hermetic and deterministic

No real clock, no sleep as synchronization, no live network/disk in unit tests, no shared files/rows assumed empty.

  • Inject a clock; tick it.
  • Wait on latches/events with a timeout, or advance a fake scheduler.
  • Unique temp paths / isolated fixtures per test.
  • Force rare failures (timeouts, thrown errors) through the double — live infra cannot.

6. Prove the test can fail

When writing or editing locally: run green, then break production (or invert the assertion) and confirm red. When reviewing and you cannot run: write the one concrete behavior bug this assertion would catch; if you cannot, treat it as a change-detector and do not approve.

When refactoring tests, put production in a known-broken state first so dropped assertions show up; then restore production. Never green-to-green "cleanup" of tests without that check.

If the only remaining test is a tautology, a mock-script of the implementation, or wiring with no logic: do not add it. Report the missing seam or the layer that should own the risk instead.

If project conventions conflict with a hard rule here (required mock-all-collaborators, sleep-based waits, tests of private helpers only): stop and cite the conflict. Do not silently follow the weaker convention.

Review checklist

A test you would merge:

  • Would fail on a real behavior bug, not only on a rename/extract
  • Asserts a result/state, not a call script (unless the call is the contract)
  • Public API / user-facing path, not an unreachable helper
  • Cause and effect visible; name states the outcome
  • Deterministic (clock/IO/uniqueness handled)
  • Failure message would start the fix without extra logging

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Testing On The Toilet?

Apply Google Testing on the Toilet (TotT) rules when writing tests, reviewing a test diff, choosing mocks vs fakes, diagnosing brittle or change-detector tests, DAMP vs DRY test structure, SMURF/pyramid layer choice, or flaky time/sleep/shared-fixture tests. Instructs what a good test asserts and what to refuse. Not a Vitest/runner cookbook and not an E2E authoring workflow.

Навіщо використовувати Testing On The Toilet у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Testing On The Toilet — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Testing On The Toilet у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/shamashel/testing-on-the-toilet/tree/main/skills/testing-on-the-toilet. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Testing On The Toilet?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Testing On The Toilet?

Зі скількома забажаєте. У TypingMind ви можете використовувати Testing On The Toilet із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Testing On The Toilet?

На GitHub цю навичку публікує shamashel. Умови ліцензування дивіться в репозиторії. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇