Antipatterns in Test Automation
dfsfds
Test automation is used more and more widely in software development. Frameworks have grown more powerful and extensible, and they can even get help from AI. Yet the same kinds of failures keep showing up across teams: flaky tests, slow scheduling, unstable locators and brittle architecture.
And these problems rarely come from the tools themselves. Usually they come from certain antipatterns that recur in a project.
Because automation is not just about writing tests. It is also about writing good tests, designing test architecture, thinking about maintainability and making long-term decisions. But some testers still carry these bad habits, and they gradually erode the reliability of the framework.
Below we walk through some of the most destructive automation antipatterns, why they appear, what impact they have and how to fix them.

Covering Everything in One Shot
At work, most of us have seen or done this: build one giant test script and try to cover the entire user journey.
It does not look problematic, and it feels like a lot of scenarios are covered. But in reality this is one of the biggest automation traps.
Such a test usually includes:
- Login
- Navigating across multiple pages
- Creating data
- Editing data
- Deleting data
- Verifying several UI parts
- Logout
It is like a linear assembly line: if any one step fails, the whole scenario collapses.
These tests are:
- Extremely brittle – a single button change can break the entire suite.
- Hard to debug – you spend more time investigating than fixing.
- Slow – they drag our CI pipeline down.
- Misleading – they give a false sense of coverage while ignoring the details.
For example:
| |
This test does everything, and that is exactly the problem.
To avoid it, we need to:
- Have each test focus on one specific behaviour.
- Do setup/cleanup through the API or the database, not through the UI.
- Not test everything in one scenario – test each part independently.
This reduces complexity, speeds up execution and makes automation more stable.
Picking Locators Casually (Such as the First One That Works)
One of the biggest sources of UI instability is choosing the wrong locator.
Many automation writers grab the first XPath or CSS selector that appears, paste it into the code and move on. It may work at first, but the trouble is that the first locator that “works” is often the most brittle one.
For example, some bad practices include:
- A full XPath 15 levels deep
- Using dynamically generated IDs
- Using huge style-related CSS selectors
- Using text-based locators that change every sprint
- Using index-based elements such as (//button)[3]
An example:
| |
If a designer moves one div, the whole case collapses.
Choosing the first working locator is bad because:
- Tests become flaky.
- Every small UI change triggers a wave of failures.
- Our automation needs constant maintenance.
- New members struggle to understand what is being tested.
To fix this, we need stable, readable locators that last, and the recommended ones include:
- data-testid
- Accessibility IDs
- Short and meaningful IDs
- Predictable CSS classes
Test script developers should work with developers at all times to improve testability, because good automation starts with a testable product.
Copy-Paste Test Frameworks
This happens more often than people admit. A QA person is in a hurry to deliver automation, so they hastily put a framework together in one or two days and immediately start writing tests.
At first it looks “fast and efficient”, but a few months later it turns into a nightmare.
The usual results of this approach are:
- Duplicated code across tests
- No configuration files
- Environment URLs hard-coded in scripts
- No folder structure
- The same selectors and functions repeated 20 times
- No reusable components
- No abstraction layer
For example:
| |
One day the login button changes – and suddenly 40 tests fail. You have to fix all 40. What a terrifying maintenance burden!
What makes this approach so bad:
- Maintenance becomes painfully slow.
- Small UI changes require huge refactoring.
- New QA people cannot get up to speed quickly.
- Tests become inconsistent in style, logic and stability.
To avoid that nightmare, we need a solid foundation that saves months of work later. We need to invest in a proper automation architecture:
- A clear folder structure
- Page Object Model or screenplay pattern
- Centralized waits
- Global configuration and environment variables
- Reusable helpers
- Logging, reporting and error handling
Overusing “wait”
This one is very common too.
Test failed?
Let us add 5 seconds.
Still failing?
Let us add 10 seconds.
Still failing?
Let us add 20 seconds just to be safe.
A Classic Example
| |
Suddenly the whole suite needs 30 extra minutes every day.
This is a terrible practice because:
- It massively increases execution time.
- It makes passing tests more a matter of luck than accuracy.
- It hides real performance problems in the application.
- It makes debugging much harder.
- It creates false confidence in test stability.
We should always wait for a condition rather than wait aimlessly. To fix this antipattern, we need to use:
- Explicit waits
- Condition-based waits
- Element state checks
- API polling instead of UI waiting
- Visual waits in modern AI-based frameworks
Automating Everything
100% automation coverage should absolutely not be our goal. Some scenarios change too often, are not stable enough, are too complex to automate, carry no real business value, or need genuine human judgment. Those scenarios do not belong in our automation suite.
There are also scenarios that should not be automated at all:
- UI tests targeting animations
- Tests for rapidly changing UI screens
- Very deep exploratory scenarios
- One-off rare feature flows
- Tests with inconsistent external dependencies
If you automate these, you will:
- Waste time automating tests that keep failing
- Start maintaining tests instead of improving quality
- Get false positives and false negatives
- Spend days fixing tests that do not matter
So before automating a scenario, we should ask ourselves four simple questions:
- Is the test stable?
- Will this test still be relevant in three months?
- Does it save manual work?
- Is it critical to the business?
If the answer is no – keep it manual.
Preparing Data Through the UI Instead of the API
Some test teams prepare all test data through the UI. That includes creating users, uploading files, updating settings, setting environment state and so on. Every such step makes our UI tests slower and more brittle.
This is not good practice, because the UI is the slowest and most fragile layer. On top of that, doing these things through the UI introduces unnecessary steps, which increases instability. Preparing data via API or directly in the database is simpler and faster.
To avoid this problem, good practice is:
- Create test data through the API
- Clean up through the API or the database
- Use the UI only to verify actual behaviour
Ignoring Flaky Tests
We have discussed flaky tests already. They usually live in unstable locators, wrong waits, inconsistent environments, race conditions in the UI, broken test data setup or third-party dependencies.
Whenever we notice a flaky test, we should not ignore it. We should treat flakiness as a P1-level defect.
Once we find a flaky test, we should:
- Track the flakiness of every test
- Monitor flaky tests with a dashboard or tags
- Focus on the root cause
- Not rely on retries to “hide” the problem
Automation without stability is not automation – it is chaos.
Testing on Only One Browser or Device
If we run all our tests on Chrome only, on a single Android device, or on a single iOS simulator, that is not enough, because users are everywhere. Users are on Safari, different iPhones, foldable Android devices, high-resolution tablets, dark mode and more.
If we use only one device, bugs can appear on devices our automation never touched, browser-specific bugs can slip into production, layout problems can show up on real devices, and our automation may give us a false sense of safety.
To avoid this, we should always build a test matrix based on the product requirements, for example:
- Chrome + Safari (minimum)
- One real Android device
- One real iPhone
- Light mode + dark mode
- At least 2 to 3 screen sizes

This catches UI problems earlier and raises confidence.
Relying on CI Without Running Anything Locally
We should not treat the CI pipeline as a personal debugging environment, and we should not push code to the pipeline and hope for the best.
This is not good practice, because it can block the whole pipeline, break the main branch, slow the entire team down and make debugging harder since CI takes longer.
To avoid these problems, we should always:
- Confirm that tests run locally before pushing changes to the pipeline.
- Run a small subset of tests locally
- Leave full regression to CI, but test the basic functionality yourself
No Logs, No Screenshots, No Traces
Our tests should provide rich result information, not just a “pass/fail” status. Some frameworks do not save screenshots, do not capture console logs, do not record video, do not collect network traces and do not produce clear reports, which makes debugging harder and more complicated.
We should always explore what our framework can do, perhaps with extra plugins, HTML reporters or third-party tools, to generate this valuable information about test results. That information matters enormously to us as QA, and to the whole team and other stakeholders as well.
Closing Thoughts
As you can see, in these examples the biggest automation failures usually come from quick decisions, bad habits and a lack of structure.
By avoiding these antipatterns, our automation suite will be more stable, maintainable, fast and reliable, and it will be trusted by the team.
Automation needs planning and discipline, not just tools.
