240 likes | 332 Views
Art for Chapter 11, Testing. Management plan. Test planning. User interface design. Object design. Unit test. From ODD. From RAD. From TP. From RAD. Continued on next slide. Continued on next slide.
E N D
Management plan Test planning User interface design Object design Unit test From ODD From RAD From TP From RAD Continuedon next slide Continuedon next slide Figure 11-1, Testing activities and their related work products (continued on next slide). Developer Client User Usability test Integration Integration test strategy System Structure test decomposition From SDD Functional Functional test requirements
Functional test User manual Project agreement Performance test Field test Daily operation Installation test Acceptance test Figure 11-1 (continued from previous slide). Developer Client User Functionalrequirements From RAD Nonfunctionalrequirements From RAD
Test suite is revised by exercises * 1…n * Test case Component Correction * * * Test stub finds repairs * Test driver * * * * * * Failure Error Fault is caused by is caused by Figure 11-2, Model elements used during testing.
Figure 11-8, A fault can have a mechanical cause, such as an earthquake.
Figure 11-9, Test model with test cases. TestA1:TestCase TestA:TestCase TestA2:TestCase precedes precedes TestB:TestCase TestC:TestCase
Figure 11-11, Equivalent flow graph for the getNumDaysInMonth() method implementation of Figure 11-12. [year < 1] throw1 [month in (1,3,5,7,10,12)] n=32 [month in (4,6,9,11)] n=30 [month == 2] [leap(year)] throw2 n=29 n=28 return
Figure 11-12, An example of a (faulty) implementation of the getNumDaysInMonth() method (Java). (continued on next slide) public class MonthOutOfBounds extends Exception {…}; public class YearOutOfBounds extends Exception {…}; public class MyGregorianCalendar { publicstaticboolean isLeapYear(int year) { boolean leap; if (year%4) { leap = true; } else { leap = false; } return leap; } /* … continued on next slide */
Figure 11-12, An example of a (faulty) implementation of the getNumDaysInMonth() method (Java). (continued from previous slide) /* … continued from previous slide */ publicstaticint getNumDaysInMonth(int month, int year) throws MonthOutOfBounds, YearOutOfBounds { int numDays; if (year < 1) { thrownew YearOutOfBounds(year); } if (month == 1 || month == 3 || month == 5 || month == 7 || month == 10 || month == 12) { numDays = 32; } elseif (month == 4 || month == 6 || month == 9 || month == 11) { numDays = 30; } elseif (month == 2) { if (isLeapYear(year)) { numDays = 29; } else { numDays = 28; } } else { thrownew MonthOutOfBounds(month); } return numDays; } ... }
Figure 11-13, Equivalent flow graph for the (faulty) isLeapYear() method implementation of Figure 11-12 and derived tests. [(year%4) == 0)] leap=true leap=false return
Figure 11-14, UML statechart diagram and resulting tests for 2Bwatch set time function. (test cases on next slide) 3.pressButtonsLAndR 1. 2. 6. pressButtonL pressButtonL pressButtonR MeasureTime pressButtonR SetTime 4.after 2 min. 5.pressButtonsLAndR/beep 7.after 20 years 8.after 20 years DeadBattery
Figure 11-15, A Strategy pattern for encapsulating multiple implementations of a NetworkInterface. Application NetworkConnection NetworkInterface open() send() close() receive() send() setNetworkInterface() receive() LocationManager Ethernet WaveLAN UMTS open() open() open() close() close() close() send() send() send() receive() receive() receive()
Figure 11-17, Equivalent flow graph for the expanded source code of the NetworkConnection.send() method of Figure 11-16. [nif instanceof Ethernet] eNif.isReady() [nif instanceof WaveLAN] wNif.isReady() uNif.isReady() [ready] ; [nif instanceof Ethernet] eNif.send() [nif instanceof WaveLAN] wNif.send() uNif.send()
Figure 11-18, Example of a hierarchal system decomposition with three layers. Layer I User Interface (A) Layer II Billing (B) Event Service (C) Learning (D) Layer III Database (E) Network (F) Neural Network (G)
Figure 11-19, Bottom up test strategy. After unit testing subsystems E, F, and G, the bottom up integration test proceeds with the triple test B,E,F and the double test D,G. User Interface (A) Billing (B) Event Service (C) Learning (D) Database (E) Network (F) Neural Network (G) T riple test Double test B,E,F D,G
Figure 11-20, Top down test strategy. After unit testing subsystem A, the integration test proceeds with the double tests (A,B), (A,C), and (A,D), followed by the quad test (A,B,C,D). Double tests A,B; A,C; A,D Quad test User Interface (A) A,B,C,D Billing (B) Event Service (C) Learning (D) Database (E) Network (F) Neural Network (G)
Figure 11-21, Sandwich testing strategy. Top layer Test A,B Test A Test A,C Test A,B,C,D Test A,D Bottom layer Test G Test D,G Test F Test B,E,F Test E Test A,B,C,D, E,F,G
Figure 11-22, An example of modified sandwich testing strategy. Top layer Test A,B Test A Test A,C Test A,B,C,D Test A,D Target layer Test B Test C Test D Bottom layer Test G Test D,G Test F Test B,E,F Test E Test A,B,C,D, E,F,G
Figure 11-23, An example of use case model for a subway ticket distributor. Passenger <<extends>> PurchaseTicket <<extends>> TimeOut Cancel <<extends>> <<extends>> NoChange OutOfOrder
Figure 11-26, Example of a PERT chart for a schedule of the sandwich tests shown in Figure 9-19.
Figure 11-27, JUnit test framework. Test TestResult run(TestResult) TestCase TestSuite testName:String run(TestResult) run(TestResult) addTest() setUp() tearDown() runTest() ConcreteTestCase setUp() tearDown() runTest()