Testing Strategies Software Engineering Andreas Zeller • Saarland University

Testing Strategies Software Engineering Andreas Zeller • Saarland University

From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 and Pezze + Young, “Software Testing and Analysis”, Chapters 1–4 Testing Strategies Software Engineering Andreas Zeller • Saarland University 1 2 Perspective of quality difers from one person to another. Also, it difers in the customers’ and developers’ Quality perspectives. 3 From Oxford dictionary Testing • Testing: a procedure intended to establish the quality, performance, or reliability of something, esp. before it is taken into widespread use. 4 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Software Testing • Software testing: the process of exercising a program with the specific intent of finding errors prior to delivery to the end user. 5 Letʼs recall the Waterfall model. Waterfall Model (1968) Communication project initiation requirements gathering Planning estimating scheduling tracking Modeling analysis design Construction code test Deployment delivery support feedback 6 In the second half of the course, we focus on construction and deployment Waterfall Model – essentially, all the activities that take (1968) place after the code has been written. Communication project initiation requirements gathering Planning estimating scheduling tracking Modeling analysis design Construction code test Deployment delivery support feedback 7 So, we simply assume our code is done – ☺We built it! 8 – but is it ready for release? Shall☹ we deploy it? 9 Itʼs not like this is the ultimate horror… 10 …but still, this question causes fear, uncertainty and doubt in managers We built it! 11 Therefore, we focus on the “construction” stage – and more Waterfall Model specifically, on the “test” in here. (1968) Construction code test 12 and the question is: how to make your Waterfall Model code ready for deployment. (1968) Construction code test Deployment delivery support feedback 13 These activities are summarized as V&V – verification and validation See Pressman, ch. 13: “Testing V&V Strategies” • Verification: Are we building the Ensuring that software product right? correctly implements a specific function • Validation: Are we building the Ensuring that software has right product? been built according to customer requirements 14 (from Pezze + Young, “Software Testing and Validation and Verification Analysis”) SW Actual Specs Requirements System Validation Verification Includes usability Includes testing, testing, user feedback inspections, static analysis, proofs 15 Verification or validation depends on the spec – this one is unverifiable, but validatable Validation (from Pezze + Young, “Software Testing and Analysis”) • “if a user presses a request button at floor i, an available elevator must arrive at floor i soon” 16 this one is verifiable. Verification • “if a user presses a request button at floor i, an available elevator must arrive at floor i within 30 seconds” 17 When do V&V start? When are they done? Basic Questions • When do V&V start? When are they done? • Which techniques should be applied? • How do we know a product is ready? • How can we control the quality of successive releases? • How can we improve development? 18 Early descriptions of the waterfall model separated coding and testing Waterfall Model into two different activities (1968) Code Test 19 What do these facts have in common? Theyʼre all wrong! First Code, then Test • Developers on software should do no testing at all • Software should be “tossed over a wall” to strangers who will test it mercilessly • Testers should get involved with the project only when testing is about to begin WRONG 20 Verification and validation activities occur all over the software process (from Pezze + Young, “Software Testing and Analysis”) 21 This is called the “V”-model of “V&V” activities (because of its shape) (from Pezze + Young, “Software Testing V&V Activities and Analysis”) validation Module Test verification 22 This is called the “V”-model of “V&V” activities (because of its shape) (from Pezze + Young, “Software Testing Unit Tests and Analysis”) • Uncover errors at module boundaries • Typically written by programmer herself • Frequently fully automatic (→ regression) 23 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Stubs and Drivers Driver • A driver exercises a module’s functions • A stub simulates not-yet- ready modules • Frequently realized as mock objects Stub Stub 24 This is called the “V”-model of “V&V” activities (because of its shape) (from Pezze + Young, “Software Testing Integration Tests and Analysis”) • General idea: Constructing software while conducting tests • Options: Big bang vs. incremental construction 25 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Big Bang • All components are combined in advance • The entire program is tested as a whole • Chaos results • For every failure, the entire program must be taken into account 26 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Top-Down Integration A • Top module is tested with stubs (and then used as driver) StubB Stub Stub • Stubs are replaced one at a time StubC Stub (“depth first”) • As new modules StubD Stub are integrated, tests are re-run • Allows for early demonstration of capability 27 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Bottom-Up Integration • Bottom modules implemented first Driver and combined into clusters DriverC F • Drivers are replaced one at a D E time • Removes the need for complex stubs 28 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Sandwich Integration A • Combines bottom-up and StubB Stub Stub top-down integration Driver • Top modules tested with stubs, C F bottom modules with drivers D E • Combines the best of the two approaches 29 Evidence: pragmatic – there is no way a test can ever cover all possible paths TETO Principle through a program Test early, test often 30 From Pressman, “Software Engineering – a practitionerʼs approach”, Chapter 13 Who Tests the Software? Developer Independent Tester • understands the system • must learn about system • but will test gently • will attempt to break it driven by delivery driven by quality • • 31 A good tester should be creative and destructive – even sadistic in places. – Gerald Weinberg, “The psychology of The Ideal Tester computer programming” 32 The conflict between developers and testers is usually overstated, though. The Developer 33 Letʼs simply say that developers should respect testers – and vice versa. The Developers 34 Theory: As humans want to be honest with themselves, developers are blindfolded with respect to their own Weinberg’s Law mistakes. Evidence: “seen again and again in every project” (Endres/Rombach) From Gerald Weinberg, “The psychology of computer programming” A developer is unsuited to test his or her code. 35 Acceptance Testing • Acceptance testing checks whether the contractual requirements are met • Typically incremental (alpha test at production site, beta test at user’s site) • Work is over when acceptance testing is done 36 Special System Tests • Recovery testing forces the software to fail in a variety of ways and verifies that recovery is properly performed • Security testing verifies that protection mechanisms built into a system will, in fact, protect it from improper penetration • Stress testing executes a system in a manner that demands resources in abnormal quantity, frequency, or volume • Performance testing test the run-time performance of software within the context of an integrated system 37 This is called the “V”-model of “V&V” activities (because of its shape) (from Pezze + Young, “Software Testing V&V Activities and Analysis”) validation verification 38 Which techniques should be applied? Basic Questions • When do V&V start? When are they done? • Which techniques should be applied? • How do we know a product is ready? • How can we control the quality of successive releases? • How can we improve development? 39 There is a multitude of activities (dynamic ones execute the software, static ones donʼt) – and weʼd like them to end when the software is 100% Program correct. Testing (dynamic verification) Analysis Unfortunately, none of them is perfect. (static or dynamic) Inspections Proofs (static verification) (static verification) 40 Why V&V is hard (on software) • Many different quality requirements • Evolving (and deteriorating) structure • Inherent non-linearity • Uneven distribution of faults 41 If an elevator can safely carry a load of 1000 kg, it can also safely carry any smaller load; Compare If a procedure correctly sorts a set of 256 elements, it may fail on a set of 255 or 53 or 12 elements, as well as on 257 or 1023. (from Pezze + Young, “Software Testing and Analysis”) can load 1,000 kg can sort 256 elements 42 Every test can only cover a single run The Curse of Testing optimistic inaccuracy a test run a test run a test run a test run ∞ possible runs 43 Evidence: pragmatic – there is no way a test can ever cover all possible paths Dijkstra’s Law through a program Testing can show the presence but not the absence of errors 44 The halting problem prevents us from matching lock(S)/ Static Analysis unlock(S) – so our technique We cannot tell may be overly pessimistic. whether this condition ever holds (from Pezze + Young, if ( .... ) { (halting problem) ... “Software Testing and lock(S); Analysis”) } Static checking pessimistic ... for match is inaccuracy if ( ... ) { necessarily ... inaccurate unlock(S); } 45 The Java compiler cannot tell whether

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    23 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us