Lesson 1 / الدرس 1

What automation is actually for / ما الغرض الحقيقي من الأتمتة

Automated tests do not find bugs. They notice when something that used to work has stopped working — which is a narrower job than most people expect, and the reason automation frees a tester rather than replacing one.

الاختبارات الآلية لا تجد الأخطاء. بل تلاحظ حين يتوقف عن العمل شيء كان يعمل — وهذه مهمة أضيق مما يتوقعه معظم الناس، وهي سبب كون الأتمتة تحرّر المختبِر لا تستبدله.

An automated test can only check something a person already thought of, wrote down and proved once by hand. It has no curiosity. It will run the same forty steps ten thousand times without noticing that the page is now bright green, that the Arabic reads backwards, or that the button it clicked has moved somewhere absurd — because nobody told it to look.

What it is genuinely good at

  • Regression. The forty things that must still work after every change, checked in four minutes instead of a day. This is the whole reason automation exists.
  • Repetition without fatigue. A person checking the same form for the ninth time stops seeing it. A machine does not get bored, and does not skip step 6 because step 6 has never failed.
  • Scale a person cannot reach. The same test on six browsers, or a thousand rows of data, or every night at three in the morning.
  • Telling you fast. A test that fails eleven minutes after the code was written is a small correction; the same failure found three weeks later is an archaeology project.

It buys time, and the time is the point

The value of automation is not the bugs it catches — it catches very few, and they are usually ones you already knew were possible. The value is the day it gives back. A tester who no longer spends every release re-checking the same forty paths by hand can spend that release exploring the new feature, which is where the bugs actually are. Automation is a machine for converting boring work into time for interesting work.

// The same check, twice.
//
// By hand, before every release: open the page, type a wrong password,
// read the message, check you are still on the sign-in page. Ninety seconds,
// and you must not be distracted.

test('wrong password is refused', async ({ page }) => {
  await page.goto('/sign-in');
  await page.getByLabel('Email').fill('sara@example.com');
  await page.getByLabel('Password').fill('totallywrong');
  await page.getByRole('button', { name: 'Sign in' }).click();

  await expect(page).toHaveURL(/sign-in/);
  await expect(page.getByText('Email or password is incorrect')).toBeVisible();
});
Eight lines, and they are the test case you wrote in the last course — steps, then the expected result, in the same order. An automated test is a written test case that happens to be executable, which is why the course you just finished came first.

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

1. What are automated tests genuinely best at?

2. Why should you run a test by hand before automating it?

3. A team's pipeline is green, so they stop exploratory testing. What have they lost?