Sie sind auf Seite 1von 2

V

viewpoints

doi:10.1145/2001269.2001280 Phillip G. Armour

The Business of Software


Testing: Failing to Succeed
Optimizing what we learn from testing.

T
here are two situations in knowledge. We test systems primarily can’t be specific about the problems we
software testing that scare for these two of the Five Orders of Igno- are trying to detect (in advance of actu-
testers: when they see “too rance and their focus is quite different. ally running the test) or presumably we
many” defects and when would have already fixed them. How-
they do not see “enough.” Testing for 0OI ever, it is true that designing a good
Too many defects may indicate the We test to ensure the system performs test may structure our thinking so we
system contains a lot of problems as it was specified and as it was de- see the problem before we actually run
even though it has moved into the test- signed to perform. This is known as the test. In this case the test we do run
ing phase. Too few discovered defects clean testing and it is ensuring the will be focused on 0OI, proving that our
might imply the product is of high “proven” part of the definition of 0OI— preemptive knowledge insertion really
quality but it usually means the testing we are showing that what we think we works. Testing for 2OI is an unbounded
process itself is not working. know is, in fact, correct. This kind of test set—the number of things a system
This is symptomatic of the paradox testing is relatively straightforward to might do but should not is essentially
of testing: We want to find defects in the set up, run, and prove. While the 0OI infinite. This is also a difficult test set to
system under test, but we do not really test set might be large, it is bounded— create since we have to devise tests for
want to find them. While the business there are a finite number of things we something we are not specifically look-
of software has evolved from actually want any system to do. ing for. The best we can do is to apply
punishing people for finding defects, testing heuristics: test to the boundar-
we can still be pretty ambivalent about Testing for 2OI ies of ranges, test all classes on inputs
them. Experienced testers have a good The other kind of testing we do is to try and outputs, test all combinations of
feel for the balance between finding too and flush out any 2OI—we run dynamic multiple logic conditions, and so forth.
many defects and not finding enough2 tests on a system to see if there is any- To expose our ignorance about system
but most organizations and most cus- thing we don’t know we don’t know usability, we might put the system in
tomers would still prefer to hear “we about how the system actually runs. We front of a naïve user and see what hap-
haven’t found many defects” than
“we’ve found huge numbers of defects.” Figure 1. Information content equation.

1 1
Testing as Knowledge Acquisition Information Content of a Test = Pf * log ( ) + Ps * log ( )
Pf Pf
If we view testing as a knowledge acqui-
sition activity rather than simply a post
hoc quality assurance process we get a Figure 2. Binary view of information content of a test.
different view. We also get a different
view when we line testing up against the
Five Orders of Ignorance.1 Zero Order
Information Obtained

Ignorance (0OI) is lack of ignorance; it is


from Test Set

proven knowledge, knowledge that we


have acquired and against which some
trial has made that certifies it as “cor-
rect.” Second Order Ignorance (2OI) is
lack of awareness of ignorance; it occurs
0% 50% 100%
when we don’t know something and we
Probability of “Failure” in a Test Set
are unaware that we don’t know it. That
is, we have ignorance about our lack of

30 communications of th e ac m | octo ber 2 0 1 1 | vol . 5 4 | no. 1 0


viewpoints

pens. We might simply “monkey test” all shows the system is very, very good Figure 2. In the simple binary view the
by firing all manner of random data at and there are no lapses in the knowl- maximum amount of information is
the system. In all these cases we do not edge that we built into the system. But returned when tests have a 50% prob-
know a priori what will happen. We are this is unusual and most testers would ability of success (no error thrown). At
looking for something, but we do not be very suspicious if they saw no de- that point, of course, they also have a
quite know what it is. fects at all, especially early in a testing 50% probability of failure.
cycle. Logic aside, emotion would sug-
Not Testing for 1OI gest that a set of 2OI tests that exposed Managing Test Complexity
First Order Ignorance (1OI) occurs 100% errors would also not be a “good” This gives testers a metric by which to
when we do not know something but we test run. While finding such a huge design test suites. If a set of tests does
are fully aware of what we do not know. number of errors might be better than not return enough defects we should
We should never test for 1OI. If we truly not finding them, it indicates either a increase the test complexity until we
knew in advance what we did not know criminally poor system or a criminally see about half the tests throw errors. We
and where the limitations of our sys- poor test setup. In the second case the would generally do this by increasing
tem’s knowledge lie, we would resolve knowledge we acquire by testing relates the number of variables tested between
our ignorance first, incorporate what we to how we conduct tests that might be tests and across the test set. Contrari-
have learned into the system, and then easily learned and fixed. In the poor sys- wise, if we see that more than 50% of
conduct a 0OI clean test to prove it. tem case our ignorance is in the system the test cases expose defects, we should
being tested and it may indicate an aw- back off the complexity until the failure
A Successful Test ful lot of rework in the requirements, rate drops to the optimal level.
Here we see the dichotomy of testing: design, and coding of the system. This This optimization is ideal for knowl-
for 0OI a “successful test” does not is not an effective use of testing. In- edge acquiring (2OI) tests. For knowledge
expose any new knowledge, it simply deed, it might be that we are actually us- proving (0OI) tests, the ideal is 100%
proves our existing knowledge is cor- ing testing as a (very inefficient) way to pass rate. The problem is, we do not
rect. On the other hand, a 2OI test does gather requirements, design, and code know in advance that (what we think
expose new knowledge, but usually the system since the original processes is) a 0OI test won’t expose something
only if it “fails.” The two yardsticks for clearly did not work. we were not expecting. And sometimes
success in testing: passing and failing So if 0% defect detection is too low, what is exposed in a 0OI test is really
tests are focused on these two different and 100% defect detection is too high, important, especially since we weren’t
targets. This is partly where the tension what is the right number? Well, it expecting it. Still, as we migrate test-
between exposing and not exposing de- would be somewhere between 0% and ing from discovery to proof we should
fects comes from. While having defects 100%, right? To find where this sweet expect that the failure rate will switch
in our system is clearly a bad thing, spot of defect detection is, we need to from 50% to 100%. How this should
finding them in testing (versus not look back to 1928. happen is a story for another day.
finding them) is equally clearly a good
thing. As long as there aren’t too many. Transmission of Information I Knew That
In 1928, Ralph Hartley, a telephone I showed this concept to a tester friend
How Much of a Good Thing? engineer at Bell Labs, identified a of mine who has spent decades testing
For our 0OI testing 100% passing is the mechanism to calculate the theoretical systems. His response: “I knew that.”
goal. Any test that “fails” indicates the information content of a signal.3 If we He said. “I mean, if no errors is bad
presence of 2OI in the system (or the think of the results of a test run as sig- and all errors is bad, of course a good
test setup or possibly sloppiness in nals containing information about the answer is some errors in the middle
testing, which is a different, Third Or- system that are transmitted from the and 50% is in the middle, right? I don’t
der Ignorance, process kind of failure). system under test to the tester, at what need an 80-year-old logarithmic for-
For 0OI testing, the ideal situation is point is this information maximized? mula derived from telegraphy informa-
that every bit of knowledge we baked Hartley showed the information con- tion theory to tell me that.”
into our system is correct and the suc- tent of a signal is proportional to the Hmm, it seems the unconscious art
cessful tests simply prove it. logarithm of the probability that the of software testing is alive and well.
But what about the 2OI tests? Logic event occurs. Viewing a test result as a
would suggest that a set of 2OI tests simple binary—a test throws a defect References
1. Armour, P.G. The Laws of Software Process. Auerbach
that exposed no defects at all would not (“failure”) or a test does not throw a de- Publishers, Boca Raton, FL, 2004, 7–10.
be a good test run since nothing new fect (“success”)—the information con- 2. Armour, P.G. The unconscious art of software testing.
Commun. ACM 48, 1 (Jan. 2004).
would be learned.a It is possible that tent returned is given by the equation 3. Hartley, R.V.L. Transmission of information. Bell
Systems Technical Journal, 1928.
a test run that exposed no defects at shown in Figure 1, where Pf = probabil- 4. Reinertsen, D.G. The Principles of Product
ity of failure (error is detected); Ps = prob- Development Flow. Celeritas Publishing, Redondo
Beach, CA, 2009, 93.
a Information theory does assert that the knowl- ability of success (error is not detected).4
edge content of a system is increased by a 2OI The graph of this function is shown in
test that “passes”—specifically it assures that Phillip G. Armour (armour@corvusintl.com) is a senior
the system will not throw an error under the consultant at Corvus International Inc., Deer Park, IL,
and a consultant at QSM Inc., McLean, VA.
specific conditions the test employed and pro- However, since the possible 2OI test set is func-
vides some assurance for certain related tests. tionally infinite, this assurance is not strong. Copyright held by author.

o cto b e r 2 0 1 1 | vo l . 5 4 | n o. 1 0 | c o m m u n i c at i o n s o f t he acm 31

Das könnte Ihnen auch gefallen