
In short
- Each test level looks at a bigger piece of the system: one function, parts working together, the whole system, then the business need.
- Lower levels are fast and pinpoint problems; higher levels are slow but catch problems that only appear when everything is connected.
- A good strategy uses all four, with most tests at the bottom and a few, carefully chosen, at the top.
On this page
Definitions of test levels tend to blur together on paper. So instead of defining them, let’s follow one feature through all four: a shop adds coupon codes. SAVE10 takes 10% off orders of $40 or more, once per customer.
01Unit testing: one piece, on its own
A unit test checks the smallest piece of logic in isolation, usually a single function or class, with everything around it faked. Here, that’s the function that works out the discount.
test('SAVE10 takes 10% off a $50 order', () => {
expect(applyCoupon(50, 'SAVE10', { usedBefore: false })).toBe(45);
});
test('SAVE10 does nothing below $40', () => {
expect(applyCoupon(39.99, 'SAVE10', { usedBefore: false })).toBe(39.99);
});
test('SAVE10 can only be used once per customer', () => {
expect(() => applyCoupon(50, 'SAVE10', { usedBefore: true })).toThrow('already used');
});- Catches: wrong maths, wrong edges (is $40.00 included?), missing rules.
- Misses: everything outside the function. Is the coupon actually saved? Does the checkout page call this function at all?
- Who writes them: usually developers, alongside the code.
02Integration testing: do the pieces work together?
Integration tests check that parts which work alone also work when connected. For the coupon, that means the discount function, the database that records who has used which code, and the cart service talking to each other.
- Apply
SAVE10through the cart service and check the cart total in the database changed. - Apply it, place the order, and check the "used" record was written for that customer.
- Apply it again for the same customer and check the service refuses, using the real database rather than a fake flag.
03System testing: the whole thing, end to end
System testing checks the complete, deployed application against its requirements, the way a user would reach it: through the browser or the public API, with real services behind it.
- Add $50 of products, enter
SAVE10at checkout, pay, and check the receipt email shows $45. - Try the code on a $39.99 cart and check the page explains why it didn’t apply.
- Use it, log out, log back in, try again, and check it’s refused.
- Check what happens on a slow connection, in another browser, and on a phone.
System testing also covers things no single component owns: performance under load, security, and how the app behaves when a service it depends on is down.
04Acceptance testing: does it do what the business needed?
Acceptance testing asks a different question. Not "does it work as built?" but "is this what we wanted?" It is usually done or signed off by the product owner, the customer, or people who represent them.
- Marketing tries the coupon the way their campaign email describes it and checks the wording matches.
- Finance checks the discount shows up correctly in the sales report they reconcile every month.
- Support checks they can see in the admin screen whether a customer has already used a code, because customers will ask.
This is where you discover that the requirement said "once per customer" but marketing meant "once per email address", and guest checkouts slip through. No lower level could have found that, because every lower level tested what was written.
05All four side by side
| Level | Looks at | Speed | Typical owner | Coupon example |
|---|---|---|---|---|
| Unit | One function or class | Milliseconds | Developers | applyCoupon maths and rules |
| Integration | Parts working together | Seconds | Developers and testers | Cart service + database record usage |
| System | The whole deployed app | Seconds to minutes | Testers | Real checkout, receipt email, other browsers |
| Acceptance | The business need | Varies | Product owner, users | Matches the campaign, shows in finance reports |
06How many tests at each level
The usual advice is the test pyramid: many unit tests, fewer integration tests, and a small number of system tests through the UI. The reason is cost. A unit test runs in milliseconds and points at the exact line that broke. A UI test takes seconds, can fail for reasons unrelated to the feature, and tells you only that something somewhere is wrong.
Treat the pyramid as a guide, not a rule. Some systems are mostly wiring between services, and integration tests do most of the useful work there. What matters is that each important rule is tested at the lowest level that can actually see it, plus a few end-to-end checks that the whole journey works.
Checking your coverage across levels
- Business rules (limits, edges, once-only) have unit tests
- Every place one component hands data to another has an integration test
- The top user journeys have a small number of end-to-end system tests
- Non-functional needs (speed, security, failure of a dependency) are tested at system level
- Someone from the business has accepted each feature against what they actually need
Frequently asked questions
What are the four levels of software testing?
Unit testing, integration testing, system testing and acceptance testing. Each looks at a larger part of the software, from one function up to the whole system checked against business needs.
What is the difference between system testing and integration testing?
Integration testing checks that particular components work together correctly. System testing checks the complete, deployed application end to end, the way users reach it, including things like performance and security.
Who does acceptance testing?
Usually the product owner, the customer, or business users, sometimes with testers helping. The point is to confirm the software meets the real need, not just the written requirement.
Is end-to-end testing the same as system testing?
They overlap heavily. End-to-end testing usually means following a complete user journey through the whole system, which is a large part of system testing.
Do I need all four levels?
For anything important, yes. Each level catches problems the others can’t see. How many tests you write at each level depends on where your system’s risk is.
Written by
Vihari Panyam
QualityAIQ