Today's Updates:

Sunday, May 11, 2014

what is Error, Bug, Fault, Failure and Defect in software testing

What is an error?
Error is deviation from actual and expected value.
It represents mistake made by people.

What is a fault?
Fault is incorrect step, process or data definition in a computer program which causes the program to behave in an unintended or unanticipated manner.

It is the result of the error.

What is a bug?
Bug is a fault in the program which causes the program to behave in an unintended or unanticipated manner.
It is an evidence of fault in the program.

What is a failure?
Failure is the inability of a system or a component to perform its required functions within specified performance requirements.
Failure occurs when fault executes.

What is a defect?
A defect is an error in coding or logic that causes a program to malfunction or to produce incorrect/unexpected results.

A defect is said to be detected when a failure is observed.
So I wrote a C program as mentioned below:
Add two numbers program
Example 1:
As mentioned this program is required to add two numbers.
1        #include<stdio.h>
2       
3        int main ()
4        {
5        int value1, value2, ans;
6       
7        value1 = 5;
8        value2 = 3;
9       
10      ans = value1 - value2; 
11     
12      printf("The addition of 5 + 3 = %d.", ans);
13     
14      return 0;
15      }
When you compile and run this program you see the printed statement as below:
The addition of 5 + 3 = 2.
So after compiling and running this program we realize the program has failed to do what it was supposed to do.
The program was supposed to add two numbers but it certainly did not add 5 and 3. 5 + 3 should be 8, but the result is 2. There could be various reasons as to why the program displays the answer 2 instead of 8. For now we have detected a failure.
As the failure has been detected a defect can be raised.
Now let’s go back to the program and analyze what was the fault in the program.
1        #include<stdio.h>
2       
3        int main ()
4        {
5        int value1, value2, ans;
6       
7        value1 = 5;
8        value2 = 3;
9       
10      ans = value1 - value2;  // ----> Bug
11     
12      printf("The addition of 5 + 3 = %d.", ans);
13     
14      return 0;
15      }
We notice at line number 10, there is a ‘-’ sign present instead of ‘+’ sign. So the fault in the program is the ‘-’ sign. Line 10 has the fault which caused the program to deviate from the functionality.
Error is the mistake I made by typing ‘-’ instead of ‘+’ sign. We have observed failure in correct execution of the program. And in this case we can also say we have found the bug.
A tester does not necessarily have access to the code and may be just testing the functionality of the program. In that case the tester will realize the output is faulty and will raise a defect. Due to the observed wrong result it is known of the fact that the program has an error which resulted in the fault in the program and due to which the program failed to give the correct result. But the tester may not know exactly what is causing the error.


You may also like:
Complete Testing Material
Testing basic interview questions



2 comments:

  1. What is incident ?

    ReplyDelete
    Replies
    1. "Incident" in testing means unexpected behavior of the software.
      To be specific, we sometimes make difference between incidents and the defects or bugs. An incident is basically any situation where the system exhibits questionable behavior, but often we refer to an incident as a defect only when the root cause is some problem in the item we are testing.

      Delete

Related Posts Plugin for WordPress, Blogger...