Test Automation Mistakes Beginners Make and How to Avoid Them
Most automation projects fail slowly, through flaky tests, brittle locators and suites nobody trusts. Here are ten mistakes to spot early, with a fix for each.
- Most test automation mistakes come from speed: tools first, strategy later.
- Automate stable, repeatable, high-value checks; leave exploratory work to humans.
- Replace fixed sleeps and brittle selectors with auto-waiting and role-based locators.
- Keep tests independent, run them in CI on every change and fix flaky tests quickly.
Almost everyone who starts automating tests makes the same handful of test automation mistakes. The first scripts pass, the team gets excited, and six months later half of the suite is red for reasons nobody can explain.
These test automation mistakes are easy to avoid when you know what they look like. This guide lists ten of them, shows why each hurts, and gives a practical fix you can apply today.
The advice applies to any tool, whether you use Selenium, Playwright or Cypress. If you are still choosing a tool, read our best test automation framework guide first.
Mistake 1: Trying to automate everything
Automation is not a goal by itself. Tests that run rarely, change often or need human judgement cost more to maintain than to run by hand. Usability, visual taste and one-off checks are better done manually.
Fix: Score each candidate on frequency, stability, business risk and effort. Automate the high-risk, repeatable flows first, such as login, checkout and core APIs.
Mistake 2: Starting without a strategy
Teams often write scripts before deciding what the suite is for. Without a plan you end up with overlapping tests, no ownership and unclear results. A simple model such as the test pyramid helps you balance fast unit and API tests against slower end-to-end checks.
Fix: Write a one-page plan: scope, tools, environments, data, who fixes failures, and when tests run.
Mistake 3: Using fixed sleeps instead of proper waits
A line such as sleep(5) makes tests slow when the app is fast and flaky when it is slow. It is one of the most common test automation mistakes and the leading cause of flaky tests.
// Bad
await page.waitForTimeout(5000);
await page.click('#save');
// Better: Playwright waits for the element to be ready
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByText('Saved')).toBeVisible();
Fix: Wait for a condition, not a time. In Selenium use explicit waits; in Playwright rely on auto-waiting and web-first assertions.
Mistake 4: Ignoring flaky tests
When a test fails now and passes on a rerun, teams shrug and press retry. Soon nobody trusts a red build. Retries can hide real defects too.
Fix: Track flaky tests, quarantine them with a ticket and a deadline, and find the root cause: timing, shared data, environment or a real race condition.
Mistake 5: Weak locators
Long XPath chains and auto-generated class names break whenever the layout changes. The Playwright best practices recommend locators based on what users see, such as role and label.
// Brittle
//div[3]/form/div[2]/input
// Stable
page.getByLabel('Email')
page.getByRole('button', { name: 'Log in' })
Fix: Prefer roles, labels and dedicated test IDs. Ask developers to add data-testid attributes where needed.
Mistake 6: Copy-pasting code with no structure
Repeating the same login steps in fifty tests means one UI change breaks fifty tests. Use page objects, helper functions or fixtures so each change happens in one place. Our test automation framework example shows a clean folder layout.
Mistake 7: Tests that depend on each other
If test B needs the data created by test A, you cannot run them in parallel, and one failure causes a chain of false failures.
Fix: Make every test create its own data (through an API when possible) and clean up after itself, so it passes alone, in any order.
Mistake 8: Putting too much in end-to-end tests
UI tests are the slowest and most fragile layer. Checking every validation rule through the browser makes the suite crawl. Move logic checks down to unit and API tests and keep a small set of journeys at the top. Our guide to end to end testing best practices goes deeper.
Mistake 9: Not running tests in CI
Tests that only run on one laptop are tests that nobody trusts. Run a fast smoke set on every pull request and the full suite nightly, with reports and screenshots attached. See our GitHub Actions CI/CD guide for a starter pipeline.
Mistake 10: Poor test data and no reporting
Hard-coded accounts, shared databases and unreadable failure messages slow down debugging. Use seeded or generated data, and make sure every failure shows the step, the expected value and the actual value, ideally with a screenshot or trace.
Quick tip: Write the failure message first. If a failing test would not tell a teammate what broke, improve the assertion before adding more tests.
Checklist to avoid test automation mistakes
- Each automated test has a clear reason and an owner.
- No fixed sleeps; waits are condition-based.
- Locators use roles, labels or test IDs.
- Tests are independent and clean up their data.
- Smoke tests run on every pull request.
- Flaky tests are tracked and fixed within a set time.
- Reports include screenshots, traces or logs.
For Selenium users, the official test practices guide covers many of these points in more detail.
Final thoughts
Avoiding test automation mistakes is mostly about discipline: pick the right tests, keep them independent, wait for conditions and run them in CI. Fix one of these test automation mistakes per sprint rather than rewriting everything, and your suite will become something the team actually trusts.
Frequently asked questions
What is the biggest test automation mistake beginners make?
Trying to automate everything without a strategy. Choose stable, high-value, repeatable tests first and review the list regularly.
Why are my automated tests flaky?
Common causes are fixed sleeps, shared data, unstable locators and slow environments. Replace sleeps with condition-based waits and make tests independent.
Should I automate manual test cases one to one?
No. Many manual cases are not worth automating, and automated tests should be shorter and more focused than manual scripts.
How many UI tests should a suite have?
Keep UI tests to the key user journeys and cover detailed logic with faster unit and API tests, as the test pyramid suggests.
When should automated tests run?
Run a fast smoke set on every pull request and the full regression suite on a schedule or before release.
Keep learning
Need help with testing, WordPress or SEO?
We help teams ship better software and grow their sites. Tell us what you are working on and we will suggest a clear next step.