Incorrect statement example 2

De Software testing
Ir para: navegação, pesquisa

Consider the following software requirement: "The value of y should be a function of x and y, as defined by the expression y = (x - z) / 2". The programmer, when implementing the requirement, wrote:

	y = x - z / 2

I.e., the programmer wrote an incorrect data definition in the software (made a mistake) and introduced a fault . For x = 10 and z = 8, the expected output is y = 1, but the incorrect version's output is y = 6, thus characterizing an error (as the value of y is different from the expected).