Error, Defect, Failure and Root Cause

An error (or mistake) is a human action that produces an incorrect result. A defect (also called a fault or a bug) is the imperfection the error leaves in a work product, such as a requirement, the code or a test script. A failure is what you observe when the running system does not do what it should, or does something it should not. The root cause is the underlying reason the error happened.

Example: a developer copies a name check from an older English-only form (error), so the sign-up code accepts only Latin letters (defect). A customer who types her name in Arabic script is rejected (failure). The acceptance criteria and the shared test data had English names only, so nobody noticed the gap (root cause).

Why it matters

The right word decides what happens next. A failure is evidence you can show; a defect is what a developer must locate; the root cause is what the team must change to stop the next similar defect. A precise failure report, with the input, the expected result and the actual result, lets the developer find the real defect instead of chasing your guess.

The distinctions also protect your judgement. A passed test does not prove the code is right, because not every defect produces a failure. A failed test does not prove the product is wrong, because the environment, the test data or the test itself can be at fault.

From error to defect to failure

The ISTQB Foundation syllabus describes a chain: people make errors, errors produce defects, and defects may result in failures. The error happens in a person’s head or hands. The defect sits in a work product until someone removes it. The failure happens at run time, when the defective part is executed under conditions that expose it.

Defects are not only in code: a requirement that contradicts another, a test script that checks the wrong field and a build file that packages an old library are defects too. An undetected defect in an early work product often leads to more defects later: a wrong requirement leads to wrong code and to tests that agree with it.

  • Error (mistake): misreading a requirement, typing > instead of >=, forgetting a case.
  • Defect (fault, bug): can be found by a review, without running anything.
  • Failure: can only be observed while the system runs.
  • Some teams say "bug" for both the defect and the failure, and "error" for a message in a log. In reports, say which one you mean.

Defects without failures, failures without defects

The syllabus is explicit: some defects cause a failure every time the code runs, some only in specific circumstances, and some never. A defect stays latent when its code never runs, or never runs with the data that triggers it. That is why a passed test is evidence, not proof.

Errors and defects are also not the only causes of failures. The syllabus names environmental conditions, such as radiation or electromagnetic fields affecting firmware. In everyday testing the causes outside the code under test are more ordinary: a test server that is down, a third-party sandbox that times out, an expired certificate. Some still trace back to a human error elsewhere (a wrong value in a deployment configuration is a defect in that file), but the owner and the fix differ.

  • Only in specific circumstances: a date calculation that breaks only on 29 February.
  • Latent: a rounding defect in a currency the shop has not enabled yet.
  • Masked: a defect in step 3 of checkout cannot show while another defect makes step 2 fail every time. The ISTQB glossary calls this defect masking.
  • Environment: a form submission returns 503 Service Unavailable while the test environment’s e-mail service is being redeployed.

Try it: AI Error Message Analyzer

Root cause: why the error happened

A root cause is the fundamental reason a problem occurred, often a situation that led to the error. The syllabus lists typical reasons why people make errors: time pressure, the complexity of work products, processes, infrastructure or interactions, fatigue and a lack of training. Fixing a defect removes one problem; addressing its root cause can prevent similar defects or make them rarer.

Root cause analysis usually starts when a failure occurs or a defect is found, and keeps asking why until the answer is something the team can change. If three defects in one sprint show times in the wrong time zone, three fixes remove three defects. The root cause, such as having no agreed rule for storing and showing times and no test data from other time zones, keeps producing new ones until the team changes it.

False positives and false negatives

Tests can be wrong too. The ISTQB glossary calls a test result that reports a defect which does not exist a false-positive result, and one that misses a defect which is present a false-negative result. "Positive" here means "the test said there is a problem". The glossary also calls them a false-fail and a false-pass result.

  • False positive: a checkout test fails because its test data uses a coupon that expired last week, which the product rightly rejects. The cost is investigation time.
  • False negative: a price test passes because it checks only that a total is displayed, not that it is correct. The defect reaches users unnoticed.
  • Before reporting a failure, rule out the test: rerun it, check its data, environment and expected result, and compare expected and actual output side by side. Before trusting a pass, read what the test actually checks.

Try it: Text Diff Try it: JSON Diff

Worked example: an Arabic name rejected at sign-up

Requirement R-07: "The full name field accepts Arabic and English letters and spaces, 2 to 60 characters." A tester signs up as Sara Alqahtani and the account is created. With the same name in Arabic script, the form answers "Name contains invalid characters". That is the failure.

She reports the input, the expected result and the actual result; the developer finds the defect below by debugging. When one submission during the session returned 503 Service Unavailable, she reran the test after the environment recovered and told its owner instead of filing a sign-up defect.

  • Defect: the pattern accepts only Latin letters and spaces.
  • Error: the developer copied it from an older English-only newsletter form without rechecking R-07.
  • Root cause: the acceptance criteria and the shared test data contained English names only.
  • A false negative found on the way: an API test had sent an Arabic name for weeks but checked only the status 200; the response body said invalid_name.
  • After the fix: confirmation testing with both names, and Arabic examples added to the acceptance criteria and the test data.
// signup/validate.js
const NAME_PATTERN = /^[A-Za-z ]{2,60}$/;  // Latin letters and spaces only

NAME_PATTERN.test('Sara Alqahtani');  // true  -> account created
NAME_PATTERN.test('سارة القحطاني');   // false -> "Name contains invalid characters"
Sign-up example: English-only examples (root cause) lead a developer to copy an English-only pattern (error), leaving a Latin-only check (defect) that rejects an Arabic name at run time (failure).
  1. 1Root causethe situation behind the errorAcceptance criteria and shared test data hold English names only

    Gate: leads to

  2. 2Error (mistake)a human actionThe developer copies the name pattern of an old English-only form

    Gate: produces

  3. 3Defect (fault, bug)in a work product: the codeThe sign-up check accepts Latin letters and spaces only/^[A-Za-z ]{2,60}$/

    Branch: Never run with an Arabic name: the defect stays latent, no failure

    Gate: executed with a name in Arabic script

  4. 4Failureobserved while the system runsA valid name is rejected: "Name contains invalid characters"Fail

Back to step 1 Root cause analysis starts at the failure and keeps asking why

Outside the sequence
  • A failure with no defect in the sign-up code503 Service Unavailable while the test environment’s e-mail service is redeployed

Try it: Regex Tester Try it: AI Bug Description Generator

Common mistakes

  • Writing "there is an error in the validation function" when what you observed is a failure. The message on screen belongs to the failure, the wrong code is the defect and the error was a person’s action: report what you saw and leave locating the defect to debugging.
  • Treating a passed test as proof that there is no defect.
  • Reporting every failed test as a product defect without ruling out the environment, the test data and the test itself.
  • Fixing the defect and never asking why it happened, so the same kind of defect returns.
  • Naming a person as the root cause. "Careless developer" changes nothing; unclear requirements, missing examples or time pressure can be changed.

The QA perspective

On a team, testers usually see failures first and report them, developers debug to find the defect, and the team looks for the root cause of the defects that matter most: severe ones, production escapes and recurring ones. Your report feeds every step, so record the build, environment, data, steps, expected and actual results, and evidence such as a screenshot or a log line.

Before reporting, ask: does it reproduce on a healthy environment, is the expected result still what the requirement says, and does the test check the right thing? After the fix, retest with the original data and suggest what would have prevented the defect: a clearer acceptance criterion, a review checklist item or better test data. In reviews you find defects directly, before any failure exists.

Practice exercise

Classify seven notes from one test session

Your task

These seven notes come from one test session on an online pharmacy’s checkout. Label each as an error, a defect, a failure, a root cause, a failure caused by the environment, a false positive or a false negative, then say what you would do next.

Material
1. With 25 items in the cart, the order total includes only the first 20 items.
2. The loop that adds up cart prices runs at most 20 times.
3. The developer took a 20-item cart limit from an old design note.
4. The design note was not updated when the product owner removed the limit.
5. A test fails with "connection refused": the database container was not started.
6. A test with 25 items passes; it checks only that some total is displayed.
7. A test expects a 15 SAR delivery fee; the product shows 10 SAR, the fee agreed last week.
Steps
  1. Give each note one label.
  2. Arrange notes 1 to 4 as a chain in the order they happened.
  3. For notes 5 to 7, write what you would check and do before reporting anything.
Show the model answer
Model answer

1 is the failure: the observed total is wrong. 2 is the defect in the code. 3 is the error that produced it. 4 is the root cause: a process gap that let an outdated note survive a requirement change.

In the order they happened: 4 → 3 → 2 → 1. The report describes 1 (the exact cart, the expected total and the actual total), the developer finds 2 by debugging, and the team addresses 4, for example by reviewing design notes whenever a requirement changes.

5 is a failure caused by the environment, not by the checkout code. As a checkout test result it is also a false positive, because it points to a defect the checkout code does not have, so that label is defensible too. Either way, do not file a checkout defect: start the database container, rerun the test and tell the environment owner.

6 is a false negative: the test passes although the defect is present, because it checks too little. Add a check of the exact expected total.

7 is a false positive: the test fails but the product is right. Confirm the change with the product owner, then update the expected result.

Frequently asked questions

Is a bug the same as a defect?

In ISTQB terms, yes: bug and fault are synonyms of defect. In everyday speech people also say "bug" for the failure they saw. In a report, describe the failure you observed and leave locating the defect to debugging.

Who finds the root cause, the tester or the developer?

Usually the team together. The developer finds the defect by debugging, but the root cause often lies in requirements, process or communication, so the analysis needs product, development and testing. The tester brings facts: where and how the defect was found, and which tests missed it.

If a test fails because the environment is down, is that a failure?

Yes: the system did not behave as expected. But the cause is not a defect in the code you are testing, so do not file it as a product defect. Tell the environment owner and rerun the test when the environment is healthy.

Is a false positive always the fault of the test script?

No. By definition the product is not at fault, but the cause can be the script, an outdated expected result, the test data or the environment. Find which one, correct it, and note it so the same false alarm does not cost time again.

References

  • ISTQB Certified Tester Foundation Level (CTFL) v4.0ISTQB · 2023The foundation syllabus of software testing: test levels and types, test design techniques, test management and tools.
  • ISTQB GlossaryISTQBThe standard definitions of testing terms — test case, regression testing, severity, priority, boundary value analysis and the rest.

Practise with Mutqan tools

Test regular expressions live with match highlighting, capture groups and replace preview.

Utilities

Compare two texts line by line or word by word and highlight differences.

Formatting

Compare two JSON documents semantically and highlight added, removed and changed values.

JSON & Data

Turn rough notes into a complete bug report: steps to reproduce, expected vs actual, environment, severity and attachments checklist.

Bug Analysis AI

Explain stack traces and error messages, identify likely root causes and next debugging steps with Mutqan AI.

Bug Analysis AI

Go deeper

Your progress on this topic

Part of the QA Roadmap