Skip to content
Bugwise
Menu
Tutorials

Intro to Test Automation

What automated tests really are, how to read one line by line and map it to a manual test case, the tools you'll meet, how to write cases that are easy to automate, how to read a failed run, and how a manual tester starts learning automation.

intermediate Mobile & web
Short on time? Switch to the quick version.

At Tably, a restaurant booking app, the automation engineer, Sara, posts in the team chat: “Nightly run: 212 passed, 3 failed, 1 flaky. Can someone from QA look at the booking failures before standup?” (A flakyFlaky testA test that sometimes passes and sometimes fails without any change to the code.Open in glossary → test is one that sometimes passes and sometimes fails with no change in the app.) You open the report. There’s a red test called guest can book a table, a screenshot, a video and something called a trace. You’ve tested booking by hand a hundred times, but you’ve never read a line of test code.

You don’t need to become a programmer to work well with automation. But you do need to read a test, know what it checks and what it doesn’t, write cases that are easy to automate, and tell a real bug from a broken test. This lesson gives you all four, plus a path if you want to go further.

Part Not started

What an automated test really is

A test automationTest automationUsing scripts to run test steps and check the results without a person doing it by hand.Open in glossary → script is a manual test case written in a language a computer can run: it opens the app, does the steps, and checks the expected result with an assertionAssertionThe line in an automated test that checks the expected result and fails the test if it's wrong.Open in glossary →. If every assertion holds, the test passes. If one doesn’t, it fails and reports what it saw instead.

What automation does well, and what it can’t do:

Automation is great atAutomation can’t
Repeating the same checks on every build, at night, in minutesNotice things nobody told it to check
Running hundreds of data combinationsJudge whether something looks wrong or feels confusing
Checking APIs and calculations exactlyExplore, get curious or follow a hunch
Never getting tired or skipping a stepTest a feature that doesn’t exist yet

So automation doesn’t replace testers. It takes over the repeated checks, so humans can spend their time on new features, exploration and the things scripts can’t see. Which checks are worth automating is covered in Regression and Smoke Suites; where automated tests sit in the test pyramidTest pyramidA model recommending many fast unit tests, fewer integration tests and few end-to-end tests.Open in glossary → is in Levels of Testing.

Checking vs testing

Testers often separate two ideas:

  • Checking: confirming a known expectation. “After booking, the text Booking confirmed appears.” A machine can do this perfectly, thousands of times.
  • Testing: learning about the product, questioning it, noticing what’s odd. “The confirmation appears, but the time shown is in the restaurant’s time zone, not mine. Is that confusing?” Only a human does this.

Automation is excellent at checking. It only sees what someone told it to look at. If the confirmation screen shows the wrong restaurant name but the test only checks for Booking confirmed, the test passes happily.

What automation does well, and what it can’t

Automation is great atAutomation can’t
Repeating the same checks on every build, at night, in minutesNotice things nobody told it to check
Running hundreds of data combinationsJudge whether something looks wrong or feels confusing
Checking APIs and calculations exactlyExplore, get curious or follow a hunch
Never getting tired or skipping a stepTest a feature that doesn’t exist yet

Myths you’ll hear

MythReality
“Automation will replace manual testers.”It replaces repeated checks. Teams with good automation usually spend more human time on exploration and new features, not less.
“Once it’s automated, it’s done.”Tests need maintenance whenever the app changes. A suite nobody maintains turns red, then gets ignored.
“A green run means no bugs.”It means the checks someone wrote still pass. It says nothing about what nobody checked.
“Automate everything.”Automating unstable, visual or one-off checks costs more than it saves. See Regression and Smoke Suites for what’s worth it.

Most teams follow the test pyramidTest pyramidA model recommending many fast unit tests, fewer integration tests and few end-to-end tests.Open in glossary →: many fast unit tests written by developers, fewer API tests, and a small number of slow UI tests on top. This lesson focuses on the UI and API tests, because those are the ones testers read, review and often help design.

Check this part

  1. What does an assertion do in an automated test?

  2. Why doesn't automation replace manual testers?

An automated test is a script that does the steps and checks the expected result; it repeats checks perfectly but only sees what it was told to look at.

Part Not started

Reading a test, line by line

Here is a manual test case and the same test in playwrightPlaywrightA free, popular tool for automating web tests in Chromium, Firefox and WebKit browsers.Open in glossary →, a popular tool for web tests. You don’t need to know the language to see that they’re the same thing.

The manual test case:

TitleGuest can book a table for 4 at 19:30
PreconditionRestaurant 42 has free tables tonight
Steps1. Open restaurant 42. 2. Tap 19:30. 3. Set party size to 4. 4. Tap Book.
Expected“Booking confirmed” is shown, with 19:30 and 4 guests.

The automated test:

test('guest can book a table for 4 at 19:30', async ({ page }) => {
  await page.goto('/restaurants/42');                          // step 1
  await page.getByRole('button', { name: '19:30' }).click();    // step 2
  await page.getByLabel('Party size').fill('4');                // step 3
  await page.getByRole('button', { name: 'Book' }).click();     // step 4

  await expect(page.getByText('Booking confirmed')).toBeVisible();   // expected
  await expect(page.getByText('19:30 · 4 guests')).toBeVisible();    // expected
});

How to read it:

The precondition isn’t in the code: in real projects it’s usually prepared before the test starts, for example by creating data through the API.

The four parts of every test

PartIn a test caseIn code
NameTitletest('guest can book a table…')
SetupPreconditionsCode before the steps, often in a beforeEach block or a helper that creates data through the API
StepsStepsgoto, click, fill, selectOption, press
ChecksExpected resultexpect(…).toBeVisible(), toHaveText(…), toHaveURL(…)

Many teams also have a teardown: code that cleans up after the test (cancels the booking, deletes the test user), so the next run starts clean.

Locators: how a test finds things

A locatorLocatorThe way an automated test finds an element on the screen, such as a button or a field.Open in glossary → tells the test which element to use. This is where testers can help most, even without coding:

LocatorExampleVerdict
By role and namegetByRole('button', { name: 'Book' })Best. Finds it like a user and a screen readerScreen readerSoftware that reads the screen aloud for blind and low-vision users, like VoiceOver or TalkBack.Open in glossary → would.
By labelgetByLabel('Party size')Great for form fields.
By textgetByText('Booking confirmed')Good for messages.
By test IDgetByTestId('book-button')Stable, used when there’s no good visible name. Developers add data-testid attributes for it.
By CSS pathlocator('div.css-1x9ab > button:nth-child(3)')Fragile: breaks on any layout change and nobody can tell what it means.

Other styles you’ll see

Check this part

  1. In an automated test, which lines correspond to the expected result of a test case?

  2. Which locator is most stable and readable?

A test has a name, setup, steps and assertions, just like a test case; locators find elements the way a user would.

Part Not started

Reviewing a test without writing code

Automation engineers often ask testers to review tests, because you know what the feature should do. You don’t need to judge the code style. You check whether the test really tests what its name says, and look for a handful of classic problems.

ProblemWhat it looks likeWhy it matters
No real checkSteps, but no expect(…), or a check that’s never usedThe test can never fail: false confidence on every run
Fixed waitwaitForTimeout(5000), sleep(5)Too slow when the app is fast, too short when it’s slow: a classic source of flaky testsFlaky testA test that sometimes passes and sometimes fails without any change to the code.Open in glossary →
Brittle locatorLong CSS paths, nth-child, generated class namesBreaks on every layout change
Hard-coded environment or dataA full staging URL, a real email, “restaurant 42” that someone might deleteCan’t run elsewhere; breaks when data changes
Tests that depend on each other“Uses the booking from the test above”Fails for the wrong reason when order changes or the first test fails
Checks too littleOnly checks that a message appearsPasses while showing the wrong time or restaurant

What to look for

  1. Does it check what its name promises? A test called guest can book a table that only checks the URL changed isn’t checking the booking. Compare the expect lines with the expected result you’d write by hand.
  2. Can it fail? Look for steps with no expect after them, or checks whose answer nobody uses (in Playwright, isVisible() without expect just returns true or false and moves on).
  3. Does it wait the right way? Fixed waits (waitForTimeout, sleep, Thread.sleep) make tests slow and flakyFlaky testA test that sometimes passes and sometimes fails without any change to the code.Open in glossary →. Good tools wait automatically for an element to appear.
  4. Will it survive a redesign? Locators by role, label, text or test ID survive; long CSS paths don’t.
  5. Is it independent? Each test should create its own data and clean up after itself. A test that needs another test to run first will fail randomly when tests run in parallel or in a different order.
  6. Does it run anywhere? Environment addresses and credentials belong in configuration, not in the test.
  7. What does it not check? This is your strongest contribution. “It checks Booking confirmed, but not the time or party size. Should it?” “There’s no test for a fully booked evening.” That’s the same coverageTest coverageHow much of the product, requirements or risks your tests actually check.Open in glossary → thinking you use for manual cases.

Try it on two real-looking tests:

🔍 Review this automated test

An automation engineer asks you to review two tests for Tably’s booking flow. You don’t need to write code to spot the problems. Tap every line you think is a problem, then check.

0 lines flagged

Check this part

  1. A test's last line is page.getByText('Booking confirmed').isVisible() with no expect. What's the problem?

  2. Why are fixed waits like waitForTimeout(5000) a problem?

You can review tests without writing code: look for missing checks, fixed waits, brittle locators, hard-coded environments and tests that depend on each other.

Part Not started

Writing cases that are easy to automate

Your manual regression cases are often what automation engineers turn into scripts. A case that’s clear for a human is usually easy to automate; a vague one forces the engineer to guess, and the script ends up checking the wrong thing.

  • Exact data: “party size 4, time 19:30, restaurant Test Bistro”, not “a normal booking”.
  • Measurable expected results: “Booking confirmed with 19:30 · 4 guests”, not “booking works”.
  • Independent: each case sets up its own data and doesn’t rely on another case running first.
  • Stable test data: test accounts and restaurants that are created for testing and never change by hand.
  • One purpose per case: a case that checks booking, email, loyalty points and the calendar invite in one go is hard to automate and hard to debug.

When choosing what to automate first, rank candidates by how often they run, how stable the feature is, how risky it is, and how much effort the test takes. Stable, frequent, risky and cheap goes first.

From vague to automatable

Automatable

Precondition: test restaurant Test Bistro has free tables at 19:30 today (created through the API). Steps: open Test Bistro, tap 19:30, set party size 4, tap Book. Expected: Booking confirmed is shown with 19:30 · 4 guests; the booking appears in My bookings.

Vague

Steps: make a booking at some restaurant. Expected: the booking works and everything looks OK.

What helps automation engineers

HabitWhy
Exact data in every caseThe script needs concrete values; guessing leads to checking the wrong thing.
One clear purpose per caseWhen it fails, everyone knows what broke.
Independent setupTests run in parallel and in any order.
Stable, dedicated test dataShared data that people edit by hand breaks tests overnight.
Ask for test IDs or labelsIf an element has no visible name, ask developers for a data-testid or an accessible label.
Mark what’s worth automatingA tag or field like Automation candidate in your test management tool.

Ranking candidates

Score each candidate from 1 to 3 on four questions and start with the highest totals:

Question3 points1 point
How often does it run?Every buildOnce a year
How stable is the feature?Hasn’t changed in monthsRedesigned every sprint
How risky is a bug there?Money, data, sign-inCosmetic
How cheap is the test?API call, clear resultReal devices, cameras, real payments, visual judgment

For Tably, sign in, search restaurants and book a table score high; the new seasonal menu banner scores low and stays manual.

Check this part

  1. Which test case is easiest to automate?

  2. Which feature is the best first candidate for automation?

Write cases with exact data, one clear result per check, independent setup and stable test data, and rank automation candidates by frequency, stability, risk and effort.

Part ProNot started

Reading a failed run

Back to Sara’s message: three tests failed overnight. A red test doesn’t automatically mean a bug in the app. Your job is to find out what kind of failure it is before anyone files or fixes anything.

A failed test has four possible causes:

CauseTypical clueWhat to do
Real bug in the appYou can reproduce it by handFile a bug report, link the failed run
Broken testThe app changed on purpose (new button text), the test didn’tTell the automation engineer; the test needs an update
Flaky testFlaky testA test that sometimes passes and sometimes fails without any change to the code.Open in glossary →Passes on rerun, fails again laterReport it as a test problem; don’t just rerun until green
EnvironmentMany unrelated tests fail at once; server errors, timeoutsCheck the test environment and data before anything else

Use the evidence the run gives you: the error message, the screenshot and video at the moment of failure, and, in Playwright, the trace, a step-by-step recording with network calls. Then try it by hand.

The four kinds of red

CauseTypical cluesWhat to do
Real bug in the appThe failure matches what you see by hand; it started after a specific changeFile a bug with the run link, screenshot and steps you reproduced
Broken testThe app changed on purpose (button renamed Reserve, new step added); the test still expects the old behaviourTell the automation engineer, with the story that changed it
Flaky testFlaky testA test that sometimes passes and sometimes fails without any change to the code.Open in glossary →Fails sometimes, passes on rerun; often timing (fixed waits, animations) or shared dataReport it; quarantining is fine, ignoring is not. A suite full of flaky tests stops being trusted.
Environment or dataMany unrelated tests fail at once; 500 errors, timeouts; the test restaurant was deletedCheck the environment, services and test data first

Triage, step by step

  1. Read the error message. “Expected Booking confirmed to be visible, received: element not found” is different from “Timeout 30000 ms exceeded waiting for page.goto”.
  2. Look at the screenshot and video. Is there an error page? A cookie banner covering the button? A renamed button?
  3. Open the trace if there is one. In Playwright’s trace viewer you can step through every action, see the page before and after, and inspect network calls, much like DevTools.
  4. Check what else failed. One test or forty? Forty usually means environment.
  5. Reproduce by hand on the same build and environment. If you can, it’s very likely a real bug.
  6. Report the right way. A real bug goes into a bug report that links the failed run. A broken or flaky test goes to whoever owns the test, with your findings.

Check this part

  1. Forty unrelated tests failed overnight with timeouts. What's the most likely cause?

  2. A test fails because the button text changed from Book to Reserve, as planned in this sprint's story. What is it?

A red test can be a real bug, a broken test, a flaky test or a broken environment; check the screenshot, trace and a manual repro before filing anything.

The rest of this lesson is in Bugwise Pro

The last parts of every lesson are part of Bugwise Pro. Sign in to unlock them if you have it.

Part ProNot started

If you want to learn automation

Many manual testers move into automation, or into a mixed role. You already have the most valuable part: knowing what to test. The coding part is learnable step by step.

A realistic path:

  1. HTML and DevTools: how a page is built and how to inspect elements. See DevTools for Testers.
  2. Basic JavaScript or TypeScript: variables, functions, async/await. A few weeks of practice.
  3. Playwright: install it, record a test with its codegen recorder, then clean up the recorded code (better locators, real assertions).
  4. Git and CI: commit your tests and run them in a pipeline. See Git and CI for Testers.
  5. A small portfolio project: automate 5 to 10 smoke tests of a public practice site, with a README that explains what you chose to automate and why.

AI assistants can help you write and explain test code, but review it with the same checklist as any test: real assertions, good locators, no fixed waits, independent tests. See AI in Testing.

A realistic learning path

StepWhat to learnHow long (part-time)
1HTML basics and DevTools: elements, attributes, roles, the Elements and Network panels1–2 weeks
2JavaScript or TypeScript basics: variables, strings, arrays, functions, async/await3–6 weeks
3Playwright: install, run the example tests, record with codegen, rewrite recordings with good locators and assertions2–4 weeks
4Test design in code: setup and teardown, test data through the API, page objects or helpers2–4 weeks
5Git, pull requests and running tests in CI1–2 weeks
6API tests in code, reports, traces, parallel runsongoing

Why Playwright? It’s free, works with several browsers, waits automatically, has a recorder and a trace viewer, and is widely used in job ads. Cypress and Selenium are also common; the ideas carry over. For mobile, look at Appium or Maestro once the web basics feel comfortable.

Your first recording

Playwright’s codegen opens a browser, records what you click and type, and writes the test code for you. It’s a great way to see how your actions become code. But recorded tests are a first draft: they often contain brittle locators and no real assertions. Rewrite them using what you learned in this lesson. That rewrite is where the learning happens.

Dev note: Starting a Playwright project

With Node.js installed: npm init playwright@latest creates a project with example tests. npx playwright codegen https://example.com opens the recorder. npx playwright test runs the tests, npx playwright show-report opens the HTML report, and npx playwright show-trace opens a trace file.

A portfolio project that impresses

  • Pick a public practice site made for testing (many exist for login, shopping cart and forms).
  • Automate 5 to 10 smoke tests, not 100 random ones.
  • Use good locators and real assertions, no fixed waits, and independent tests.
  • Run them in CI (for example GitHub Actions) on every push.
  • Write a README: what you automated, what you deliberately didn’t and why, and how to run it. That last part shows the tester’s judgment that hiring managers look for. See A QA CV and Portfolio Without Experience.

Using AI while you learn

AI assistants are good at explaining code (“what does await do here?”) and drafting tests. They also produce exactly the problems you reviewed earlier: waitForTimeout, CSS-path locators, checks without expect. Review AI-written tests with the same checklist, and make sure you understand every line before you commit it. See AI in Testing.

Check this part

  1. What should you do with a test recorded by Playwright's codegen?

  2. What makes an automation portfolio project stand out?

Learn HTML and DevTools, a little JavaScript or TypeScript, then Playwright with codegen, Git and CI; build one small project and use AI carefully.

The rest of this lesson is in Bugwise Pro

The last parts of every lesson are part of Bugwise Pro. Sign in to unlock them if you have it.

Before you review or hand over a test

Automation checklist for manual testers

0 of 10 checked

Key takeaways

  • An automated test is a test case a computer can run: setup, steps and assertions. Without assertions, it can’t fail.
  • Automation is great at repeated checks and can’t explore or judge, so it frees testers instead of replacing them.
  • You can read and review tests without coding: compare the name and assertions with the expected result, and look for missing checks, fixed waits, brittle locators, hard-coded environments and dependent tests.
  • Good locators find elements by role, label, text or test ID, the same way users and screen readers do.
  • Write manual cases with exact data, one clear result and independent setup, and automate stable, frequent, risky and cheap checks first.
  • A red test can be a real bug, a broken test, a flaky test or the environment. Use the screenshot, trace and a manual repro before filing anything.
  • To learn automation: HTML and DevTools, basic JavaScript or TypeScript, Playwright, Git and CI, and one small, well-explained portfolio project.

Finished this page?Nice work, this page is complete!

Mark it as done to track your progress. It's saved in this browser, no account needed.

Its cards are now in your Bites review ⚡
Esc

Type to search the whole site.