Lesson 13 / الدرس 13

Steps to reproduce / خطوات إعادة الإنتاج

A bug that cannot be reproduced gets closed, however real it was. Reproducing is a skill with a method: find the shortest path back to the failure, from a starting point anyone can reach.

الخطأ الذي لا يمكن إعادة إنتاجه يُغلق، مهما كان حقيقيًا. وإعادة الإنتاج مهارة لها منهج: أن تجد أقصر طريق يعود إلى الإخفاق، من نقطة بداية يبلغها أي أحد.

You saw it. You are certain. But the report you file says "sometimes the total is wrong", the developer cannot make it happen, and three weeks later it is closed as "cannot reproduce" — and the bug is still there, waiting for a customer. The failure was real; the report was not usable. Those are different problems and only one of them is yours to solve.

Start from somewhere anyone can stand

Your session had an account with eleven orders, a coupon applied two hours ago and a tab left open since morning. The developer has none of that. Steps that begin "on my account" or "with the basket I had" cannot be followed. Begin from a state that can be created from nothing — a fresh account, an empty basket, a signed-out browser — and build up from there in steps that are all written down.

Then take steps away

  1. Reproduce it once, writing down everything you did — twelve steps, however clumsy.
  2. Remove one step. Try again. Still broken? The step was not needed — leave it out.
  3. Repeat until every remaining step is necessary. Twelve becomes four, and those four are a description of the bug rather than of your afternoon.
  4. The steps you removed are worth a sentence too: "does not require a coupon" saves the developer testing that theory.
<h4>First attempt &mdash; 9 steps</h4>
<ol>
  <li>Sign in</li><li>Search &quot;shoes&quot;</li><li>Filter by size</li>
  <li>Open a product</li><li>Add to basket</li><li>Go back</li>
  <li>Add a second product</li><li>Open the basket</li><li>Change quantity to 2</li>
</ol>

<h4>Reduced &mdash; 3 steps</h4>
<ol>
  <li>Open /product/44 signed out</li>
  <li>Add to basket</li>
  <li>In the basket, change quantity to 2</li>
</ol>
<p><strong>Not required:</strong> signing in, searching, a second product.</p>
The same bug, twice. The second version is not merely shorter — it is a much stronger claim, because it says which of the nine things did not matter. That line is often what tells a developer where to look.

Some bugs will not reproduce every time, and that is information rather than failure. Say so plainly and precisely: "3 of 10 attempts" is a usable sentence; "sometimes" is not. An intermittent bug reported honestly with a count is far more actionable than a confident report that turns out to be wrong.

Try it live / جرّب بنفسك

Preview / المعاينة

Check yourself / اختبر نفسك

1. Why should steps to reproduce start from a state created from nothing?

2. What is the value of listing the steps you removed while reducing?

3. You saw a bug once and cannot make it happen again. What should you do?

Your task / مهمتك

Take the bug you reported in the last lesson and reduce it. Show the first attempt, the reduced version, and a line naming what turned out not to be required.

خذ الخطأ الذي أبلغت عنه في الدرس السابق واختصره. أظهر المحاولة الأولى، والنسخة المختصرة، وسطرًا يذكر ما تبيّن أنه غير لازم.

  • Both versions shown: the first attempt and the reduced one النسختان معروضتان: المحاولة الأولى والمختصرة
  • A line naming the steps that turned out not to be required سطر يذكر الخطوات التي تبيّن أنها غير لازمة
  • How many times out of how many attempts it reproduced كم مرة من كم محاولة أُعيد إنتاجه
How do you want to submit? / كيف تريد التسليم؟