Understanding Error, Defect, fault, Bug, and Failure
Salman Rahman
ISTQB? Certified Test Engineer || Sr. Software Engineer at Cefalo || SDET || Agile Practitioner
This is a common confusion that arises about the differences among Error, Defect, Fault, Bug, and Failure. Even when the difference is asked at an interview board, candidates get confused. This article will help you have a good understanding of those terms using a real-life scenario-based example
1.?Error:
Definition: An error is a mistake made by a human during the development process. It could be a coding mistake, a logic error, or a misunderstanding of requirements.
Error has 2 types:
a)????? Syntax error: A syntax error occurs when the code violates the rules of the programming language. It is a mistake in the structure of the code that prevents it from being parsed and executed. For example, in java, missing semicolon, or missing starting/closing parenthesis or any types of spelling mistakes for reserved keywords.
b)???? Runtime error: A runtime error occurs while the program is being executed. It is not detected during the compilation phase but surfaces during the actual running of the program. For example:
Trying to divide a number by zero, accessing an array index that is out of bounds, or attempting to perform an operation on incompatible data types can result in runtime errors
Example: Suppose a software developer misinterprets a requirement that states, "The system should display each of the item’s name, count and price in the shopping cart."
Hence, the developer, instead of displaying the individual item count, mistakenly implements the total number of items in the shopping cart along with the names and prices of each item.
This misinterpretation is an error.
2.?Defect/Fault:
Definition: In the context of software development and testing, the terms’ "defect" and "fault" are often used interchangeably. In many contexts, there is no significant difference between them. And both terms are used to describe problems in the software.
However, in some methodologies or specific discussions, "fault" might be used more broadly to refer to any kind of mistake or error in the software development process, missing requirement or including issues in design or requirements. On the other hand, "defect" might be more specifically associated with issues in the code.
So, we can say, a defect/fault is a flaw or an imperfection in the software code or design that can lead to a failure. Writing a piece of code that does not conform to the specified requirements, creating a potential problem.
Example: for the above scenario, the defect/fault is the incorrect implementation of the requirement, where the individual item count is not displayed as specified.
3.?Bug:
Definition: A bug is the observable outcome of a defect that occurs when the software is executed and accepted by the developer. So, when any defect is triggered, it leads to a bug. That’s why we can’t say 100% defect free software. When a QA executes the defect, then it becomes bug.
But if the QA cannot detect a bug, we can’t say there is no defect in the software. It complies the 1st testing principal of “Testing shows the presence, not the absence of defects’
Example: For the above scenario, if QA detect the requirement mismatch during testing and notify developer about the issue, developer will check it and give conformance about the issue, then the issue will be considered as a bug and QA will report it. That’s why QA report bugs to the Project management software like Jira, TestRail, Bugzilla or other management systems.
4. Failure:
Definition: A failure occurs when the software does not meet the end user's requirements and fails to perform as expected. In this case, if any defect is overlooked by QA engineers but is noticed by end users, it is considered a failure. Even also a software is fully QA verified but end users having bad feedbacks, the ultimate result is failure.
Example: As a consequence of the bug, users are unable to accurately track the number of items in their shopping cart. This failure occurs when the software does not meet the user's expectation of displaying the total number of items, impacting the functionality of the application. Furthermore, even if the developer fixes the bug, if users notice that reloading the cart page results in an empty cart, it will still be considered a failure.
In conclusion, understanding the distinctions among Error, Defect, Fault, Bug, and Failure is crucial for anyone involved in software development and testing. These terms, though sometimes used interchangeably, have specific meanings that contribute to the quality assurance and improvement process.