6.005 Software Construction Fall 2011 Prof. Rob - TopicsExpress



          

6.005 Software Construction Fall 2011 Prof. Rob Miller L2 : Test-First Programming Today o Testing o Choosing test cases o Blackbox vs. whitebox testing o Coverage o Stubs, drivers, oracles o Regression testing Real Programm ers Don’t Test (?) Here are the top-5 reasons why Louis Reasoner doesn’t want to test his code: 5) I want to get this done fast – testing is going to slow me down. 4) I started programming when I was 2. Don’t insult me by testing my perfect code! 3) Testing is for incompetent programmers who cannot hack. 2) W e’re not Harvard students – our code actually works! 1) “Most of the functions in Graph.java, as implemented, are one or two line functions that rely solely upon functions in HashMap or HashSet. I am assuming that these functions work perfectly, and thus there is really no need to test them.” – an excerpt from a 6.170 student’s e-mail The biggest problem for Louis is optimism. Change that perspective – look for things that can go wrong, rather than assuming Pollyannishly that all will go right. Testing isn’t rocket science. Except when it is: a famous case was the Ariane 5 launch vehi cle, designed and built for the European Space Agency in the 1990s. It self-destructed 37 seconds after its first launch. The reason was a control software bug that went undetected. Ariane 5’s guidance software was reused from the Ariane 4, which was a slower rocket. As a result, when the velocity calculation converted from a 64-bit floating point number (a double in Java terminology, though this software wasn’t written in Java) to a 16 -bit signed integer (a short), it overflowed the small integer and caused an exception to be thrown. The exception handler had been disabled for efficiency reasons, so the guidance software crashed... and without guidance, the rocket did too. The cost of the failure was $1 billion... a cost that might have been prevented with better testing. In PS1, we have a sequence of steps feeding each other; a stack of methods building on each other. The optimistic hacker’s approach to PS1 might build the whole thing before testing any part of it. Contrast with the engineer’s approach: isolate each component, build it and test it soundly in isolation, then plug together. Basic Principles Testing is only one part of a more general process called validation . The purpose of validation is to uncover problems in a program and thereb y increase your confidence in the program’s correctness. Validation includes
Posted on: Sun, 18 Aug 2013 06:54:53 +0000

Trending Topics



Recently Viewed Topics




© 2015