Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding what Fault, Error and Failure mean

Tags:

testing

Consider the following class:

class Xyz {
    public int count;

    public void numZero (int[] x) {
        // Effects: if x == null throw NullPointerException
        // else return the number of occurrences of 0 in x
        int count = 0;
        for (int i = 1; i < x.length; i++) //we have a bug here
            {
            if (x[i] == 0)
            {
                count++;
            }
        }

        this.count = count;
    }
}

I'm trying to wrap my head about what Fault, Error and Failure really mean.

Fault

From what I've come to understand, a Fault in this context would be a flaw in the code's written logic. So in this case the Fault would be the fact that the code instructs the computer to start iterating over all elements of v with a start index of 1 instead of the expected 0.

Error

When running the above method, we always get an Error but in once instance (when v.length == 0), as what we really want is to iterate over all elements of x, but since we're starting with i = 1, that is not really happening.

With an empty vector as input, as we don't enter the for loop, so our incorrect code isn't run, meaning that the Error doesn't happen, and everything happens as should in theory.

Failure

Since our code has a Fault that in execution-time will almost always manifest in a Error, we only have a Failure when we effectively see the incorrect output.

Assuming that an Error effectively happened in my program, we only have a Failure if it is in some way visible to the outside world. That is, had I private int count; instead of public int count; I'd never ever have an Error in my class (of course it'd be the most useless class ever!). Is this right?

Is everything I said correct or am I erring in something?

Thanks

like image 313
devoured elysium Avatar asked Jun 12 '11 16:06

devoured elysium


People also ask

What is fault and failure with an example?

Fault : It is a condition that causes the software to fail to perform its required function. Error : Refers to difference between Actual Output and Expected output. Failure : It is the inability of a system or component to perform required function according to its specification. IEEE Definitions.

How the error fault and failure are related to each other?

In software testing, how the error, fault and failure are related to each other? (A) Error leads to failure but fault is not related to error and failure. (B) Fault leads to failure but error is not related to fault and failure. (C) Error leads to fault and fault leads to failure.

What is the difference between fault and failure in software engineering?

Difference from error and failureA fault is a mistake that does not let the software perform its intended function. An error is a difference between correct and incorrect output. Failure is the state of not being able to meet an intended objective.

What is fault means in the testing?

What is a Fault? Software fault is also known as defect, arises when the expected result don't match with the actual results. It can also be error, flaw, failure, or fault in a computer program. Most bugs arise from mistakes and errors made by developers, architects.


3 Answers

  • Failure: A difference from the expected result. This is the problem you observe.
  • Fault: The cause of the failure.
  • Error: The mistake which caused the fault to occur. e.g, typos.

An example of failure, fault and error.

pre: param is an integer.
post: returns the product of the param multiplied by 2.

1. int double (int param) {
2.   int result;
3.   result = param * param;
4.   return result;
5. }

• A call to double(3) returns 9, but the post condition says it should return 6.
• Result 9 represents a failure.
• The failure is due to the fault at line 3, ( "* param" is used instead of "* 2")
• The error is a typo, ( someone typed "* param" instead of "* 2" by mistake).

Why give three different labels for a "Bug"?

They help communicate how precisely you know what the problem is.

Saying "failure" means you know something is wrong but don't know the cause.
Saying "fault" means you know the cause, but don't know why the fault occurred.
Saying "Error" means you know why the fault occurred; e.g.: The coder was distracted by a firetruck passing by.

You could ask, "But why did the person make a typo?" But that gets into into human factors and out of the scope of the question.

Source: Zhen Ming (Jack) Jiang - EECS 4413, Software Testing, York University.

like image 100
kiwicomb123 Avatar answered Nov 02 '22 09:11

kiwicomb123


First, a failure occurs whenever the actual service delivered by a system deviates from its expected service. Note that since even specifications can go wrong, the definition does not rely on them.

Second, an error is the part of the system state that may lead to a failure. The state of the system can go wrong but never reach the output, thus not lead to a failure.

Third, a fault is the cause of an error. It can be a design fault, a cosmic ray or whatever. If, as you point out, the fault is not activated, no error is produced.

Take a look at the basic concepts and terminology of dependability for more information.

like image 39
mouviciel Avatar answered Nov 02 '22 10:11

mouviciel


enter image description here

Error is a deviation from the actual and the expected result. It represents the mistakes made by the people.

Faults are the result of an error. It is the incorrect step or process due to which the program or the software behaves in an unintended manner

Bug is an evidence of Fault in a program due to which program does not behave in an intended manner

Failure is an inability of the system or components to perform its required function. Failure occurs when Faults executes

Defect is said to be detected when Failure occurs.

like image 41
Unnati Mistry Avatar answered Nov 02 '22 11:11

Unnati Mistry