SWE 205 - Introduction to Software Engineering Lecture 28 – Introduction to Software Testing 1 Lecture Outline Software testing motivation. What is a software testing? Why software fail? What is cost of software failures? What makes a good software tester? 2 Software Testing Motivation The Lion King Animated Storybook Disney’s first multimedia CD-ROM game for kids. Released at Christmas season. 26th December….. Customer Support’s Nightmare. The CD was testing only for specific PC platform. It failed on many popular PC operating system. 3 Software Testing Motivation Intel Pentium Floating-Point Bug (4195835/3145727)* 3145727 - 4195835 If answer is ZERO, your computer is fine. Anything else, you have old Intel Pentium CPU with floating-point division bug. A software bug burned into a computer chip and reproduced over and over in the manufacturing process. 4 Software Testing Motivation NASA Mars Polar Lander, 1999 3rd December 1999, Mars Polar Lander disappeared during its landing attempt. Failure Review Board concludes the likely failure reason was the unexpected setting of a single data bit. Most alarming was why the problem was not caught by internal tests. 5 Software Testing Motivation Malaysia Airlines Jetliner, August 2005 Flight between Perth, Australia and Kuala Lampur, Malaysia zoomed 3,000 feet upwards. A defective software program had provided incorrect data about the aircraft’s speed and acceleration, confusing flight computers. 6 What is Software Testing? The process of finding evidence of defects in software systems. Establishing confidence that a program does what it is supposed to do. 1. Software testing is not debugging. 2. Software testing is not quality assurance 7 Software Testing Vs Quality Assurance (QA) Testing is necessary but not enough for QA process. Testing contributes to improve quality by helping to identify problems. QA sets standards that project members (including testers) should follow in order to build a better software. 8 What is Software Testing? Correctness of software with respect to requirements or intent; Performance of software under various conditions; Robustness of software, its ability to handle erroneous input and unanticipated conditions; Installation and other facets of a software release. 9 Basic Definitions Failure Fault There is a deviation of the observed behavior of a program or a system from its specification. An incorrect step, process or data definition. Error Difference between computed, observed or measured value and the true or theoretically correct value or condition. 10 Trivial Example Failure For any integer n, square (n) = n*n. int square (int x) { return x*2; } Square (3) = 6 Fault 11 Trivial Example Correct Result For any integer n, square (n) = n*n. int square (int x) { return x*2; } Square (2) = 4 12 Important Considerations Detect system failures by choosing test inputs carefully. Determine the faults leading to the failures detected. Repair the faults leading to the failures detected; and Re-test the module/system. 13 Why do Failure Occur? Specification Design Code Other 14 Root Causes of Failures Inaccurate understanding of end user requirements. Late discovery of serious project flaws. Inability to deal with changing requirements. For example, modules that do not fit together. Untrustworthy build & release process. Implementation team’s chaos. 15 Failure Costs Disney’s Lion King CD 16 Software Testers Good understanding of the development process and its products. Ability to anticipate likely faults and errors. 17 Semantics of programs Squeeze Function Semantics of C are such that integers and characters are somewhat interchangeable. Fibonacci Function Input Domain - set of values of type ‘int’. Input domain can vary on different types of machines. 18 Semantics of programs These examples are deterministic in nature. A unique output. Different methods required for nondeterministic programs. Similarly, programs may terminate or not terminate. 19 Key Points Software testing is the process of discovering evidence of defects and failures in software systems. Test early, test often, test enough. Testers should have good understanding of the development process, product. 20 Announcements Quiz # 4 Wednesday 24/12/2008. 21