Verification vs Validation: Tested Example and Comparison Table
Verification checks that you built the product right; validation checks that you built the right product. Learn the difference with a tested coupon example where every unit test passed but five of six shoppers failed, plus a comparison table, techniques and interview answers.
- Verification asks: did we build the product right, according to the specification?
- Validation asks: did we build the right product for the people who will use it?
- Verification is mostly reviews, inspections, static analysis and spec-based tests. Validation needs the working product in front of real users or real scenarios.
- In our example, all 6 spec tests passed, yet only 1 of 6 shoppers could use the coupon. You need both.
“Verification vs validation” is one of the most common questions in testing interviews, and one of the most often memorised without being understood. The definitions sound similar, and many teams use the words interchangeably. The difference is practical, though: a product can pass every check against its specification and still fail the people it was built for.
This guide explains both terms in plain language, compares them side by side, and walks through a small Python example we actually ran, where verification passed and validation failed. If you are new to the testing process, start with our software testing life cycle guide.
Verification vs validation: the short answer
A widely quoted pair of questions, from software engineering pioneer Barry Boehm, sums it up:
- Verification: “Are we building the product right?”
- Validation: “Are we building the right product?”
Verification compares work products against specifications: requirements, designs, coding standards. Validation compares the finished product against real needs: what users, customers and the business actually require in their real environment. A specification can be wrong or incomplete, and only validation will catch that.
What is verification in software testing?
Verification is the process of checking that each work product meets the requirements and standards set for it. The ISTQB glossary describes it as confirming, with objective evidence, that specified requirements have been fulfilled. It can start on day one, long before any code runs.
Typical verification activities:
- Reviewing requirements for clarity, completeness and testability.
- Design and architecture reviews.
- Code reviews, walkthroughs and formal inspections.
- Static analysis and linting.
- Unit and integration tests written directly from the specification.
Much of verification is static: it examines documents and code without executing the product. That is why it finds defects early, when they are cheapest to fix, a key idea behind shift-left testing.
What is validation in software testing?
Validation checks that the product fulfils its intended use in its intended environment. It is dynamic: someone has to run the software and judge the result against real needs, not just against the written spec.
Typical validation activities:
- System testing with realistic end-to-end scenarios.
- User acceptance testing by customers or business users.
- Usability testing, beta tests and pilot releases.
- Exploratory testing that asks “would a real person get stuck here?”
- Checking production feedback, analytics and support tickets.
Verification vs validation comparison table
| Aspect | Verification | Validation |
|---|---|---|
| Question | Built the product right? | Built the right product? |
| Compared against | Specifications, designs, standards | User needs and intended use |
| Type | Mostly static | Dynamic |
| Needs running code? | Not always | Yes |
| When | Throughout, starting with requirements | Once a working build exists, mainly later |
| Methods | Reviews, inspections, static analysis, spec-based tests | System tests, UAT, usability, beta tests |
| Done by | Developers, testers, reviewers | Testers, users, customers, product owners |
| Finds | Deviations from the spec | Wrong or missing requirements |
| Cost of defects found | Lower, found early | Higher, found late |
A tested example: the coupon field
Here is a small, realistic case we built and ran with Python 3.13.6 and pytest 9.2.0. The written requirements were:
- R1: a coupon code is exactly 6 uppercase letters A to Z.
- R2: a valid code gives 10 percent off.
The developer implemented exactly that:
import re
def apply_coupon(total, code):
if not re.fullmatch(r"[A-Z]{6}", code):
raise ValueError("invalid coupon")
return round(total * 0.9, 2)
Verification came first. A quick static check of the file found one function and one raise statement and flagged a missing docstring, the kind of thing a code review catches. Then we wrote tests straight from R1 and R2:
def test_r1_accepts_six_uppercase():
assert apply_coupon(100, "SAVEME") == 90.0
@pytest.mark.parametrize("bad", ["SAVE", "SAVEMEE", "SAVE12", ""])
def test_r1_rejects_wrong_format(bad):
with pytest.raises(ValueError):
apply_coupon(100, bad)
def test_r2_ten_percent():
assert apply_coupon(59.99, "WINTER") == 53.99
# 6 passed in 0.01s
Every test passed. By the specification, the feature is correct.
Validation came next. We fed the function what six shoppers in a hallway usability session typed after reading the code WINTER on a printed flyer (sample data):
'WINTER' accepted
'winter' rejected
' WINTER' rejected
'WINTER ' rejected
'Winter' rejected
'WIN TER' rejected
1 of 6 shoppers got their discount
Five of six realistic inputs were rejected by a feature that passed all its tests.
Why verification passed and validation failed
Nothing was wrong with the code relative to the spec. The spec was wrong: it described the storage format of a code, not how people enter one. People type in lower case, paste with spaces and capitalise the first letter. Verification cannot catch that, because it only checks consistency with the written requirement. Validation compares the product with reality, so it exposed the gap immediately.
This is the core lesson: verification finds bugs in the implementation, while validation finds bugs in the requirements and in the understanding of the user.
Tip: when a validation failure appears, fix the requirement first, then the code, then add tests for the new rule. Otherwise the next refactor can bring the bug back.
Fixing the gap and verifying again
We updated R1 to say that input is trimmed, spaces removed and letters upper-cased before checking, and changed one line:
code = code.strip().upper().replace(" ", "")
Rerunning both checks: 6 of 6 shoppers got their discount, and the original 6 verification tests still passed. The loop from validation back to requirements and verification is normal and healthy. Add the shopper inputs to the test suite so verification now covers what validation taught you, and rerun it on every change as part of regression testing.
Verification and validation in the V-model
The V-model makes the relationship visible. The left side of the V moves down from business requirements to system requirements, design and code. Each step is verified against the step above it through reviews. The right side climbs back up through unit, integration, system and acceptance testing. Unit and integration tests mainly verify the design, while system and acceptance testing validate the product against the original needs.
Agile teams do the same thing in short loops. Code review, unit tests and checks against acceptance criteria verify each story. Sprint demos, user feedback and production metrics validate it.
Techniques at a glance
| Verification techniques | Validation techniques |
|---|---|
| Requirement reviews | End-to-end system testing |
| Design reviews and walkthroughs | User acceptance testing |
| Code reviews and inspections | Usability testing |
| Static analysis and linters | Alpha and beta testing |
| Spec-based unit tests | Exploratory testing with personas |
| Traceability matrix checks | A/B tests and production analytics |
Who does verification and validation?
Verification is shared by everyone who produces work products: developers review each other’s code, testers review requirements for testability, and architects review designs. Validation needs people who understand the real use: product owners, business users, customers and testers who think like them. Independent testers are valuable in both, because a fresh view spots assumptions the authors cannot see.
Common mistakes
- Treating a green test suite as proof of quality. It proves conformance to what was written, nothing more.
- Leaving validation to the end. Show prototypes and early builds to real users; late validation failures are expensive.
- Skipping verification because “users will test it”. Users find problems slowly and at high cost.
- Not feeding validation findings back into tests. Every real-world failure should become a requirement and a test case.
- Confusing the two in reports. Say which question each activity answers so stakeholders know what has been checked.
How to answer in an interview
Keep it short and give an example: “Verification checks that we built the product right, against the specification, mostly through reviews, static analysis and spec-based tests, and it can start before code exists. Validation checks that we built the right product for the user, by running the software in realistic conditions, for example in system testing and UAT. A feature can pass verification and fail validation if the requirement itself was wrong.” Then mention the coupon example. Concrete stories beat memorised definitions. More practice questions are in our guide to writing test cases.
Final thoughts
Verification and validation are two halves of quality. Verification keeps the implementation faithful to the plan, cheaply and early. Validation checks that the plan itself serves real people. Our coupon feature passed every verification test and still failed five of six shoppers until validation revealed the faulty requirement. Do both, and let what validation teaches you flow back into the specs and the test suite.
Frequently asked questions
What is the main difference between verification and validation?
Verification checks that the product matches its specification, or building the product right. Validation checks that the product meets real user needs, or building the right product.
Which comes first, verification or validation?
Verification usually starts first, because requirements and designs can be reviewed before any code exists. Validation needs a working build, so it happens later, although early prototypes can be validated with users too.
Is unit testing verification or validation?
Unit testing is mainly verification, because it checks code against the design or specification. System testing and user acceptance testing are mainly validation.
Is verification static or dynamic testing?
Verification is mostly static, using reviews, inspections and static analysis, although spec-based tests that run code also verify. Validation is dynamic and requires executing the software.
Can a product pass verification but fail validation?
Yes. If a requirement is wrong or incomplete, the code can match it perfectly and still fail users. In our coupon example every spec test passed while five of six shoppers were rejected.
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.