Reproducing Bugs

Expected level: Proficient

Reproducing a bug means finding the exact steps, data and conditions that make it happen every time. It turns a vague report such as "it sometimes breaks" into a scenario that you, a colleague or a test can repeat.

Gather the facts

Start with the report, then fill in what is missing. Ask for or find out:

  • What did the user do, step by step, and what did they expect?
  • What actually happened? Get the exact error text or a screenshot.
  • When did it start? Did anything change just before: a release, a configuration change, new data?
  • Who and where is affected: one user, some users, all users, one browser, one environment?
  • Logs, request identifiers and timestamps that tie the report to what the system recorded. See Log Analysis.

A well-written report already contains most of this. See Defect Reporting.

Recreate the conditions

Bugs depend on context, so match it as closely as you can:

Make it small and repeatable

Once you can trigger the bug, shrink it:

  1. Remove steps, inputs and configuration one at a time while the bug still occurs.
  2. Replace real services with fixed values where possible.
  3. Capture the result as a script, an API call or an automated test that fails.

The smallest failing case is the best clue about the cause, and it is exactly what the fix must make pass.

When it will not reproduce

  • Compare the differences between the failing and working cases: user, data, environment, version.
  • Add targeted logging and wait for it to happen again.
  • If it started at a known point, use git bisect to find the commit that introduced it: mark a good and a bad commit, then repeat the test at each step Git suggests (it can also run a script for you with git bisect run).
  • Say so honestly in the ticket, with what you tried. “Cannot reproduce” is information in itself.

Try it

Take a bug from your backlog, or invent one: a form that fails only when a name contains an apostrophe. Write down the minimal steps and input that trigger it, then express them as one automated test or a single command that fails. Hand the steps to a colleague and see whether they get the same result.

Common mistakes

  • Fixing a bug nobody has reproduced.
  • Using a different release or environment from the reporter.
  • Using real personal data without anonymising it.
  • Not recording what you tried when it will not reproduce.

Check yourself

  • What should you ask for in a vague bug report?
  • Why shrink a reproduction?
  • What does git bisect need you to provide?

Related topics

Terms

Further reading