Suppose you are testing a code component and you detected a defect; it calculates and output variable incorrectly?
a. How would you classify this defect?
b. What are the likely causes of this defect?
c. What steps could have been taken to prevent this type of defect from propagating to the code?
When you say "classify this defect" are you referring to Severity? If not, I would classify this defect based upon the application it was found in.
1. The calculation portion of the code is incorrect and not consistent with specifications.
i.e. multiplication calculation 2*2 = 5 Expected result 2*2 = 4
2. The calculation portion of the code is correct and according to specification, specification is incorrect
i.e. specification calling for a multiplication application where 2*2=5
thusly coded 2*2=5
3. The calculation portion of the code is correct but the output is directed to the an incorrect variable. Or, application/package/function reading an incorrect variable.
i.e. calculation performing 2*2=4 storing the result in variable A. Application/function/package ect reading variable B. Will become evident if A!=B if A=B this may go unnoticed.
I'm sure there are many other likely causes, but these would be my top 3.
What steps could have been taken to prevent this type of defect? Answer, Process Process Process.
All specifications should be reviewed by project stakeholders
Code should be unit tested. When dealing with code that performs detailed calculations, it is often beneficial to unit test at a line of code, or block of code level. If the root cause of this error turns out to be a problem with the actual calculation, this should have been caught in Unit Testing. Unfortunately, most software development organizations give only lip service to Unit Testing.
If it passes through Unit Testing, which it shouldnt, it should most definitely be caught during functional testing.
On the other hand, if you are referring to a defect classification rather than a severity or priority, then you should know that classifying defects is not a universal constant. For instance some may use something like:
Functional calculation defect = 7 out of 10 where 10 is the highest.
These number ratings are locally assigned and not transferrable between companies.
Success is the ability to go from one failure to another with no loss of enthusiasm.
~ Winston Churchill ~