Skip to content

Quiz: Testing That Pays for Itself

Test your understanding of bugs, kinds of tests, fixtures and mocks, critical paths, invariant tests, test coverage and flaky tests with these review questions.


1. What is a regression test?

  1. A test that checks the app is alive right after a deploy
  2. A test written after a bug is fixed that reproduces the bug and fails if it ever comes back
  3. A test that measures what share of the code runs during the tests
  4. A test that drives a browser through a whole user journey
Show Answer

The correct answer is B. "Regression" means sliding back, and a regression test stops a fixed bug from sliding back in. The scheduler test that checks marking reminder 2 leaves reminders 1 and 3 pending is one. Option A describes a smoke test. Option C describes test coverage. Option D describes an end-to-end test run through a browser test tool.

Concept Tested: Regression Test

See: Regression Tests


2. What is an integration test?

  1. A test of one function on its own, with no database or network
  2. A test a person runs by clicking through screens
  3. A test that sometimes passes and sometimes fails with no code change
  4. A test that checks several pieces working together, such as a route, its code and the database
Show Answer

The correct answer is D. "Send a request to the scan route as member A, asking for member B's scan, and check that the server answers 404" is an integration test. It runs the route, the ownership check and the database together. Option A is a unit test. Option B is manual testing. Option C is a flaky test.

Concept Tested: Integration Test

See: Kinds of Automated Tests


3. Some reminders never arrive, but the database says they were sent. Why reproduce the bug before changing any code?

  1. A repeatable case shows where the bug starts, so you don't spend days on the SMS vendor that was working fine
  2. Reproducing a bug fixes it automatically
  3. The agent can't read code until a bug is reproduced
  4. Reproducing is only needed for bugs members report
Show Answer

The correct answer is A. Three test reminders with IDs 1, 2 and 3, and one call to mark reminder 2 as sent, showed reminders 1 and 2 both marked. That pointed straight at a <= where = belonged, the root cause. Without that step, the obvious suspect was the text-message vendor. Reproducing doesn't fix anything by itself (B), agents read code anytime (C), and bugs you find yourself need it too (D).

Concept Tested: Reproducing a Bug

See: A Worked Bug: The Scheduler That Marked Too Much


4. Why is an invariant test for the no-locate rule stronger than a test with one example?

  1. It runs faster because it uses fewer fixtures
  2. It doesn't need any saved vendor responses
  3. It checks every saved fixture, so a new vendor field such as work_location is caught without writing a new test
  4. It only runs when the vendor changes its API
Show Answer

The correct answer is C. A one-example test checks that one address isn't in one report. It passes if the code handles that case and misses a field nobody thought of. The invariant test loads every people-search fixture, including ones with addresses, workplaces and coordinates, and checks that no report contains any of them. When a new vendor is added, its fixtures join the folder and the rule guards itself.

Concept Tested: Invariant Test

See: Invariant Tests


5. The agent reports that coverage is now 82 percent. Why doesn't that tell you the app is safe?

  1. Coverage counts only front-end code
  2. Coverage counts lines run, not risks checked, so the payment webhook could still be untested
  3. Coverage numbers above 80 percent are always wrong
  4. Coverage only counts tests written by people
Show Answer

The correct answer is B. Coverage is not safety. A test that calls the report builder and checks only that it returned something runs every line of the builder and would pass with an address in the report. Use coverage as a map of blind spots: ask which critical paths have zero coverage, not what the total is. The other options misstate how coverage is measured.

Concept Tested: Coverage Is Not Safety

See: Coverage Is Not Safety


6. You have time for one more set of tests this week. Which should come first?

  1. Tests that the results page looks right on every phone size
  2. Tests for the welcome email's wording
  3. Unit tests for helper functions that already work
  4. Integration tests for the payment webhook: a good payment, the same event twice, a forged event and an unknown member
Show Answer

The correct answer is D. Test critical user paths first, and the money path is one. In the dating-safety app the payment webhook had no tests, so nothing showed whether a member who paid got their credits, got them twice, or whether a stranger could forge an event. Page looks (A) and email tone (B) are good-enough-for-now parts best checked by hand. Tests of code that already works (C) are what a vague "add tests" request tends to produce.

Concept Tested: Test the Money Path

See: Test the Money Path


7. Your auth tests check that a signed-out request gets 401 and another member's ID gets 404. Which test is still missing?

  1. A test that the page loads in under a second
  2. A test that the 404 page has a friendly message
  3. A test that the owner asking for their own scan gets it
  4. A test that the session cookie is long
Show Answer

The correct answer is C. Without a test that the right person gets through, a route broken so badly that nobody can use it would pass every refusal test. The full set is: signed out gets 401, another member's ID gets 404, a viewer's change is refused by a request sent straight to the server, and the owner gets their data. Speed (A), page wording (B) and cookie length (D) aren't the auth path.

Concept Tested: Test the Auth Path

See: Test the Auth Path


8. You ask the agent to fix a bug. What loop should you ask for?

  1. Write the test, show it failing, fix the code, show it passing, then run all the tests
  2. Fix the code, then write a test that passes
  3. Fix the code, then ask whether it worked
  4. Write the test, and if it fails, change the test until it passes
Show Answer

The correct answer is A. The failing test first rule means a test isn't trusted until you've seen it fail. If it passes before the fix, the test is wrong or the bug isn't where you thought. A test written after the fix (B) may check nothing. Asking whether it worked (C) gets a claim, not evidence. Changing the test to pass (D) is the move to forbid in your instruction file.

Concept Tested: Failing Test First

See: Test-Driven Development and the Failing Test First


9. Every test mocks the image-search vendor with a response the agent wrote by hand. The vendor renames a field, and all tests still pass. What went wrong?

  1. Mocks can never be used for outside services
  2. The test runner skipped the vendor tests
  3. A mock returns what you told it the vendor returns, so a hand-written mock can't notice the vendor changed
  4. The tests should have called the live vendor every time
Show Answer

The correct answer is C. A mock is only as good as the response it was built from. Build mocks from recorded vendor responses, and refresh those fixtures when the vendor changes, so tests match what the vendor sends. Mocks are fine for outside services (A), and the runner didn't skip anything (B). Calling the live vendor every time (D) makes tests slow, costly and flaky.

Concept Tested: Mocking a Service

See: Fixtures and Stand-Ins


10. A browser test fails about one run in ten, and the team has learned to rerun it until it passes. Why is this worse than one failing test?

  1. Flaky tests use more computer time
  2. People learn to rerun every failure without reading it, so a test that catches a real bug gets ignored too
  3. Flaky tests lower the coverage number
  4. A flaky test deletes other tests
Show Answer

The correct answer is B. A flaky test trains everyone to stop trusting red. Once rerunning is the habit, a failure from a broken auth check looks just like the random one. The usual causes are timing, shared data and live outside services. Fix them by waiting for the score to appear instead of a fixed time, giving each test its own data, and mocking vendors. If you can't fix it today, quarantine it.

Concept Tested: Flaky Test

See: Flaky Tests