Logo de Testing On The Toilet

Testing On The Toilet

Comunidade
shamashel
testing-on-the-toilet

Aplique as regras do Google Testing on the Toilet (TotT) ao escrever testes, revisar um diff de testes, escolher entre mocks e fakes, diagnosticar testes frágeis ou que detectam mudanças, estruturar testes com DAMP ou DRY, escolher camadas da pirâmide/SMURF ou lidar com testes instáveis relacionados a tempo, esperas ou fixtures compartilhadas. Oriente sobre o que um bom teste deve verificar e o que deve ser recusado. Não é um guia de receitas para Vitest ou runners, nem um fluxo de trabalho para criar testes E2E.

Visão geral

Publicado porshamashel
Repositóriotesting-on-the-toilet
Nome da habilidadetesting-on-the-toilet
Estrelas
36
Forks
0
Arquivos incluídos
1
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Arquivos incluídos: 1

    Scripts, templates e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente para leitura e nunca são executados.

  • Código aberto

    Publicada por shamashel no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Testing On The Toilet no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/shamashel/testing-on-the-toilet/tree/main/skills/testing-on-the-toilet
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Testing On The Toilet em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Testing On The Toilet automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Testing On The Toilet não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

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

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Testing On The Toilet faz?

Aplique as regras do Google Testing on the Toilet (TotT) ao escrever testes, revisar um diff de testes, escolher entre mocks e fakes, diagnosticar testes frágeis ou que detectam mudanças, estruturar testes com DAMP ou DRY, escolher camadas da pirâmide/SMURF ou lidar com testes instáveis relacionados a tempo, esperas ou fixtures compartilhadas. Oriente sobre o que um bom teste deve verificar e o que deve ser recusado. Não é um guia de receitas para Vitest ou runners, nem um fluxo de trabalho para criar testes E2E.

Por que usar Testing On The Toilet no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Testing On The Toilet é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Testing On The Toilet no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/shamashel/testing-on-the-toilet/tree/main/skills/testing-on-the-toilet. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Testing On The Toilet?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Testing On The Toilet?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Testing On The Toilet com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Testing On The Toilet é gratuita?

A habilidade é publicada no GitHub por shamashel. Consulte os termos de licenciamento no repositório. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇