Sunday 8 November 2015

DIFFERENCE BETWEEN ERROR FAULT BUG FAILURE DEFECT




Test case: A test case is a set of test data that is to be inputted, expected results for each test case and resultant conditions, designed for a particular testing module in order to ensure system functionalities.
Consider the example test cases for the program to check whether an inputted year is leap year or not. Then the test case should.
Year = 2000 // non leap year which is not multiple of 400
Year = 2003 // non leap year
Year = 2004 // leap year
Test suite: It is mathematically a set which consist of all the test cases as set elements. A software can have infinite number of test cases. A good test suite should have minimal test cases which covers most errors. For the above mentioned program to check whether the inputted year is leap year or not, the test suite will be as follows:
{2000, 2003, 2004}
Error: Error is the degree of mismatch from actual result and expected result. It represents mistake made by code developers. Though error and bug sounds synonyms, they are not exactly the same. Error is the mistake found by tester. When developer accepts this mistake, then it is called as a bug.
Fault: Fault is an incorrect code statement, function or data interpretation in a computer program which makes the program or software system to generate an unexpected result. Fault leads to error.
Bug: Bug is a fault in the code block which generates an unintended result. It is normally the mistake accepted by the developer.
Failure: Failure is the inability of a software system to perform its expected functional and non-functional requirements. Execution of a fault leads to failure.
Defect: A defect is a mistake committed by programmer in coding or logic that causes a program to generate incorrect or deviated results. Normally a defect is detected when a failure occurs.

 In order to understand the above basic terminologies, consider the following code block in C language. The intention of the code block is to check whether the inputted number is even or odd.

1     void main()
2     {
3      int num;
4      printf(“ Input an integer”);
5      scanf(“%d”, &num);
6      if(num%2==0) printf(“%d is ODD number”, num);
7      else printf(“%d is EVEN number”, num);
8      }

If we execute the above program by giving the input integer as 4, then the output will be ‘4 is ODD number’. But we know that 4 is an EVEN number. There may be many reasons for why the program displays 4 as ODD instead of EVEN. So the tester realizes that the program encounters failure though the system gives an entirely different output. A defect in product may be raised because of this failure. So we should find the fault which leads to this failure. In order to find the fault, we analyze the program line by line. We found that in line 6, the program checks whether it is multiple of 2. But the programmer wrote the action statement to display the integer as ODD. So the programmer committed the error. Instead of writing as EVEN, programmer wrote it as ODD. After identifying the fault, the tester terms the error in the program as bug.

2 comments:

  1. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    ReplyDelete