What are automated tests? Explained with self-testing smoke detectors
Automated tests are small programs that re-check software after every change, so breakages are caught in minutes. Like smoke detectors that test themselves every day.
- Author
Umair Mateen- Published
- Reading time
- 5 min
- Category
- Engineering
In one sentence: Automated tests are small programs that check, again and again without a person, that software still does what it should, so a change that breaks something is caught in minutes instead of by a customer.
The everyday picture
Picture an office building with a smoke detector in every room. Nobody walks the halls each morning pressing every button. Each detector tests itself every day, and if one finds a problem, it sounds an alarm that tells you exactly which room to look at.
Now imagine the building is always being renovated. A new wall here, new wiring there. Each job could quietly damage something that used to work. Because the detectors check themselves after every job, a problem is spotted the same day, while it is small and easy to trace.
Software works the same way. Every change to the code is a small renovation. Automated tests are the self-testing detectors: they re-check the whole building after each change, and point to the room where something went wrong.
A change triggers quick checks in each room, then checks on the links between rooms, then a full drill. The result points straight to any problem.
How it works, step by step
- A developer makes a change (a renovation job). It might be a new feature, a fix or a small tweak. The UK government's service manual advises running the tests every time a change is made, so defects are found more quickly.
- Unit tests run first (each room's own detector). A unit test checks one small piece of code on its own, such as "does the discount add up correctly?". They are quick to run and simple to maintain, so teams write many of them.
- Integration tests check that pieces work together (the linked alarms). Each room can be fine on its own, yet the connection between them can fail. These tests check, for example, that the checkout really talks to the payment service.
- End-to-end tests walk a whole journey (a full fire drill). A program acts like a real customer: it opens the site, adds an item, pays and checks the confirmation. They give the most confidence, but are slower and cost more to run and maintain, so teams keep fewer of them.
- Results come back (all clear, or an alarm with a room number). If every test passes, the change can move on. If one fails, the team knows which check broke and fixes it before customers see it.
Try it · Side by side
Automated tests or a person checking: which wins where?
Tap what matters to you (pick one or more) and see which option fits.
Automated tests
- Runs in minutes, every time, without getting bored
- Catches it if a test covers that feature
- Cannot tell how something feels to use
- Only checks what it was written to check
- Effort to write and maintain, then cheap to repeat
Manual testing
- Slow, and easy to skip when the team is busy
- Only if someone happens to check that corner
- A person notices confusion straight away
- Exploring freely can turn up the unexpected
- Costs people's time on every single release
Pick what matters to you and the better fit lights up.
This mix is often drawn as a "test pyramid": many quick unit tests at the bottom, fewer integration tests in the middle and a small number of end-to-end tests at the top. Software writer Martin Fowler describes it as having many more low-level unit tests than broad tests that click through the screens. Google's web.dev guide adds that the pyramid can oversimplify, and the right mix depends on the project.
Where the picture stops
- A smoke detector comes ready-made. Automated tests must be written by people, one check at a time, and kept up to date as the software changes. A test only checks what someone thought to check.
- Smoke is always smoke. In software, "working" depends on what the business wants, so the tests are only as good as the rules written into them.
- A detector either senses smoke or it does not. Broad end-to-end tests can sometimes fail for reasons that are not real bugs, such as a slow network, and too many false alarms make teams stop trusting them.
Why it matters for your business
- Fewer surprises for customers: problems are caught before release, not reported by users.
- Faster, safer changes: the team can ship small updates often, because each one is re-checked in minutes rather than by days of manual clicking.
- Lower cost of fixing: the GOV.UK manual notes that fast feedback lets teams fix problems before they become more complicated and expensive to fix.
- People still matter: automation handles the routine checks, while people test what machines cannot judge, such as whether a screen is easy to use. Google's web.dev guide says manual testing is still essential.
An example
Imagine a small online flower shop. A developer changes how delivery fees are calculated. Within minutes, a unit test fails: orders over a set amount, which should ship free, are now being charged. The developer fixes the rule before lunch. Without that test, the first sign might have been a week of annoyed customers and refunds.
Frequently asked questions
Do automated tests replace human testers?
No. They take over repetitive checks so people can focus on exploring the product, judging how it feels to use and testing accessibility.
What is the difference between a unit test and an end-to-end test?
A unit test checks one small piece of code on its own and runs very fast. An end-to-end test acts like a real user going through a whole journey, which gives more confidence but takes longer.
When do automated tests run?
Usually on every change, as part of a CI/CD pipeline that builds and checks the code automatically. Developers can also run them on their own computers before sharing a change.
Are automated tests worth it for a small project?
For anything you will keep changing, usually yes. Writing them takes effort up front, but each later check is close to free, while manual checks cost people's time on every release.
Related explainers
The DevDrift builds web and mobile products with automated checks on every change: see how.
Sources
Could you explain this to a colleague now?
Mark it and posts that mention it will show a tick. Saved in this browser only.