PhraseryPhrasery homeGet Phrasery
Tests & QA21 categories

Review my mocking strategy

A test file with more setup than assertions.

Longmocksreviewdesign
Review how the tests below use mocks and test doubles.

1. For each mock, say what it is protecting against: slowness, non-determinism, cost, or an unavailable dependency. If it is none of those, the mock may not be needed.
2. Identify mocks that assert the implementation: verifying that a specific method was called with specific arguments, in a way that would break on a harmless refactor.
3. Find places where so much is mocked that the test can only pass, because nothing real is exercised.
4. Point out any mock whose behaviour has drifted from the real thing, so the test passes while production would fail.
5. Recommend which mocks to replace with a fake, a real instance, or a contract test.

Say which parts of this setup are already right, so I do not rewrite them.

Tests:

Making it yours

  • Paste your own material where the prompt asks for it. Everything above that line is instruction, not content.
  • Delete any rule that does not apply to you. A shorter prompt that fits beats a thorough one that does not.
  • If the answer comes back vague, add a line saying what you do not want. Constraints work better than encouragement.

Reviewing existing tests. Judging naming, mocking, and whether a test asserts behaviour or just the implementation.

Related prompts

Keep this one

Phrasery saves prompts with a right-click and puts them back the same way. Add this to your own library in one click.

Add to your browser โ€” free