Presentation on theme: "Chapter 11, Testing, Part 2: Integration and System Testing"— Presentation transcript:
1 Chapter 11, Testing, Part 2: Integration and System Testing
2 Overview Integration testing System testing Acceptance testing Summary Big bangBottom upTop downSandwichContinuousSystem testingFunctionalPerformanceAcceptance testingSummary
3 Integration TestingThe entire system is viewed as a collection of subsystems (sets of classes) determined during the system and object designGoal: Test all interfaces between subsystems and the interaction of subsystemsThe Integration testing strategy determines the order in which the subsystems are selected for testing and integration.For the selection of the subsystems we use the system decomposition from System DesignKürzen?Tonspur: Übergang Unit Test zu Integration
4 Why do we do integration testing? Unit tests only test the unit in isolationMany failures result from faults in the interaction of subsystemsOften many Off-the-shelf components are used that cannot be unit testedWithout integration testing the system test will be very time consumingFailures that are not discovered in integration testing will be discovered after the system is deployed and can be very expensive.
5 Stubs and drivers Driver: Stub: A component, that calls the TestedUnit Controls the test casesStub:A component, the TestedUnit depends onPartial implementationReturns fake values.DriverTestedUnitStub
6 Example: A 3-Layer-Design (Spreadsheet)Spread SheetViewBinaryFile StorageEntityModelAEFCurrency DataBaseGCurrencyConverterDBCalculatorCXMLFile StorageASpread SheetViewALayer IBCDBData ModelCalculatorCDCurrencyConverterLayer IIFor the following integration testing strategies, we use this call hierarchy of an example designconsisting of 3 layers and 7 subsystems.EFGEBinaryFile StorageFXMLFile StorageCurrency DataBaseGLayer III
7 Big-Bang Approach Test A Test B Test C Test A, B, C, D, Test D E, F, G This unit tests each of the subsystems, and then does one gigantic integration test, in which all the subsystems are immediately tested together.Don‘t try this!! Why: The interfaces of each of the subsystems have not been tested yet.Test DTest ETest FTest G
8 Bottom-up Testing Strategy The subsystems in the lowest layer of the call hierarchy are tested individuallyThen the next subsystems are tested that call the previously tested subsystemsThis is repeated until all subsystems are includedDrivers are needed.
9 Bottom-up Integration CEFGDBABCDTest EEFGTest B, E, FThis unit tests each of the subsystems, and then does one gigantic integration test, in which all the subsystems are immediately tested together.Don‘t try this!! Why: The interfaces of each of the subsystems have not been tested yet.Test FTestA, B, C, D,E, F, GTest CTest GTest D,G
10 Pros and Cons of Bottom-Up Integration Testing Tests the most important subsystem (user interface) lastDrivers neededProNo stubs neededUseful for integration testing of the following systemsObject-oriented systemsReal-time systemsSystems with strict performance requirements.
11 Top-down Testing Strategy Test the top layer or the controlling subsystem firstThen combine all the subsystems that are called by the tested subsystems and test the resulting collection of subsystemsDo this until all subsystems are incorporated into the testStubs are needed to do the testing.
12 Top-down Integration Test A, B, C, D, E, F, G Test A Test A, B, C, D This unit tests each of the subsystems, and then does one gigantic integration test, in which all the subsystems are immediately tested together.Don‘t try this!! Why: The interfaces of each of the subsystems have not been tested yet.TestA, B, C, D,E, F, GTest ATest A, B, C, DLayer ILayer I + IIAll Layers
13 Pros and Cons of Top-down Integration Testing Test cases can be defined in terms of the functionality of the system (functional requirements)No drivers neededConsWriting stubs is difficult: Stubs must allow all possible conditions to be tested.Large number of stubs may be required, especially if the lowest level of the system contains many methods.Some interfaces are not tested separately.
14 Sandwich Testing Strategy Combines top-down strategy with bottom-up strategyThe system is viewed as having three layersA target layer in the middleA layer above the targetA layer below the targetTesting converges at the target layer.How do you select the target layer if there are more than 3 layers?Heuristic: Try to minimize the number of stubs and drivers
15 Sandwich Testing Strategy BCDTest AEFGTest A,B,C, DTest EAnpassenTestA, B, C, D,E, F, GTest B, E, FTest FTest D,GTest G
16 Pros and Cons of Sandwich Testing Top and Bottom Layer Tests can be done in parallelProblem: Does not test the individual subsystems and their interfaces thoroughly before integrationSolution: Modified sandwich testing strategy
17 Modified Sandwich Testing Strategy Test in parallel:Middle layer with drivers and stubsTop layer with stubsBottom layer with driversTop layer accessing middle layer (top layer replaces drivers)Bottom accessed by middle layer (bottom layer replaces stubs).
19 Continuous Testing Continuous build: Requires integrated tool support: Build from day oneTest from day oneIntegrate from day oneSystem is always runnableRequires integrated tool support:Continuous build serverAutomated tests with high coverageTool supported refactoringSoftware configuration managementIssue tracking.
21 Steps in Integration Testing 1. Based on the integration strategy, select a component to be tested. Unit test all the classes in the component.2. Put selected component together; do any preliminary fix-up necessary to make the integration test operational (drivers, stubs)3. Test functional requirements: Define test cases that exercise all uses cases with the selected component4. Test subsystem decomposition: Define test cases that exercise all dependencies5. Test non-functional requirements: Execute performance tests6. Keep records of the test cases and testing activities.7. Repeat steps 1 to 7 until the full system is tested.The primary goal of integration testing is to identify failures with the (current) component configuration..
22 System Testing Functional Testing Performance Testing Validates functional requirementsPerformance TestingValidates non-functional requirementsAcceptance TestingValidates clients expectationsWhen we are system testing, we are testing all subsystems together.The requirements have a large impact on the quality of system testing:The more explicit the requirements, the easier they are to test.We distinguish the following types of system testingLet’s walk through each of these system testing types
23 Functional Testing Goal: Test functionality of system Test cases are designed from the requirements analysis document (better: user manual) and centered around requirements and key functions (use cases)The system is treated as black boxUnit test cases can be reused, but new test cases have to be developed as well.Essentially the same as black box testingUnit test cases can be reused, but in end user oriented systems new test cases have to be developed as well..
24 Performance Testing Goal: Try to violate non-functional requirements Test how the system behaves when overloaded.Can bottlenecks be identified? (First candidates for redesign in the next iteration)Try unusual orders of executionCall a receive() before send()Check the system’s response to large volumes of dataIf the system is supposed to handle 1000 items, try it with 1001 items.What is the amount of time spent in different use cases?Are typical cases executed in a timely fashion?Push the (integrated) system to its limits.
25 Types of Performance Testing Stress TestingStress limits of systemVolume testingTest what happens if large amounts of data are handledConfiguration testingTest the various software and hardware configurationsCompatibility testTest backward compatibility with existing systemsTiming testingEvaluate response times and time to perform a functionSecurity testingTry to violate security requirementsEnvironmental testTest tolerances for heat, humidity, motionQuality testingTest reliability, maintain- ability & availabilityRecovery testingTest system’s response to presence of errors or loss of dataHuman factors testingTest with end users.Stress TestingStress limits of system (maximum # of users, peak demands, extended operation)Volume testingTest what happens if large amounts of data are handledConfiguration testingTest the various software and hardware configurationsCompatibility testTest backward compatibility with existing systemsSecurity testingTry to violate security requirements
26 Acceptance TestingGoal: Demonstrate system is ready for operational useChoice of tests is made by clientMany tests can be taken from integration testingAcceptance test is performed by the client, not by the developer.Alpha test:Client uses the software at the developer’s environment.Software used in a controlled setting, with the developer always ready to fix bugs.Beta test:Conducted at client’s environment (developer is not present)Software gets a realistic workout in target environ- mentMajority of all bugs in software is typically found by the client after the system is in use,not by the developers or testers. Therefore two kinds of additional tests:Alpha testBeta test: … One disadvantage: Potential customers might get discouraged
27 Testing has many activities Establish the test objectivesDesign the test casesWrite the test casesTest the test casesExecute the testsEvaluate the test resultsChange the systemDo regression testing
28 Test Team Test Team Professional Tester Analyst System Designer User too familiarProgrammerwith codeAnalystSystemDesignerTestUserTeamConfigurationManagementSpecialist
29 The 4 Testing Steps 1. Select what has to be tested Analysis: Completeness of requirementsDesign: CohesionImplementation: Source code2. Decide how the testing is doneReview or code inspectionProofs (Design by Contract)Black-box, white box,Select integration testing strategy (big bang, bottom up, top down, sandwich)3. Develop test casesA test case is a set of test data or situations that will be used to exercise the unit (class, subsystem, system) being tested or about the attribute being measured4. Create the test oracleAn oracle contains the predicted results for a set of test casesThe test oracle has to be written down before the actual testing takes place.
30 Guidance for Test Case Selection Use analysis knowledge about functional requirements (black-box testing):Use casesExpected input dataInvalid input dataUse design knowledge about system structure, algorithms, data structures (white-box testing):Control structuresTest branches, loops, ...Data structuresTest records fields, arrays, ...Use implementation knowledge about algorithms and datastructures:Force a division by zeroIf the upper bound of an array is 10, then use 11 as index.Rauslassen?
31 SummaryTesting is still a black art, but many rules and heuristics are availableTesting consists ofUnit testingIntegration testingSystem testingAcceptance testingDesign patterns can be used for integration testingTesting has its own lifecycle
Your consent to our cookies if you continue to use this website.