Published on

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. (OO) Integration Testing What: Integration testing is a phase of software testing in which individual software modules are combined and tested as a group. It follows unit testing and precedes system testing. Informally - a (design) point of view Why: The purpose of integration testing is to verify functional, performance and reliability requirements placed on major design artefacts . How : integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. But choosing the integration order is non-trivial!
  2. 2. (OO) Integration vs RegressionTesting – another (incremental development) point of view Integration tests are performed when new code is added to an existing code base; for example, when a new function is added to a set of existing functions. Integration tests measure whether the new code works -- integrates -- with the existing code; these tests look for data input and output, correct handling of variables, etc. Regression testing is the counterpart of integration testing: when new code is added to existing code, regression testing verifies that the existing code continues to work correctly, whereas integration testing verifies that the new code works as expected. Regression testing can describes the process of testing new code to verify that this new code hasn't broken any old code. Question : is this incremental view a good way of thinking about integration testing or is the design view better?
  3. 3. Integration Testing: What about OO? <ul><li>The components to be tested are object classes that are instantiated as objects </li></ul><ul><li>Larger grain than individual functions so approaches to white-box testing have to be extended </li></ul><ul><li>No obvious ‘top’ to the system for top-down integration and testing </li></ul><ul><li>Levels of integration are less distinct in object-oriented systems </li></ul><ul><li>Cluster testing is concerned with integrating and testing clusters of cooperating objects </li></ul><ul><li>Identify clusters using knowledge of the operation of objects and the system features that are implemented by these clusters </li></ul>
  4. 4. Integration Testing: What Clusters? <ul><li>Use-case or scenario testing </li></ul><ul><ul><ul><ul><li>Testing is based on a user interactions with the system </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Has the advantage that it tests system features as experienced by users </li></ul></ul></ul></ul><ul><li>Thread testing </li></ul><ul><ul><ul><ul><li>Tests the systems response to events as processing threads through the system </li></ul></ul></ul></ul><ul><li>Object interaction testing </li></ul><ul><ul><ul><li>Tests sequences of object interactions that stop when an object operation does not call on services from another object </li></ul></ul></ul>
  5. 5. (OO) Integration Testing Tests complete systems or subsystems composed of integrated components Integration testing should be black-box testing with tests derived from the specification Main difficulty is localising errors Incremental integration testing reduces this problem
  6. 6. <ul><li>Component testing </li></ul><ul><ul><li>Testing of individual program components </li></ul></ul><ul><ul><li>Usually the responsibility of the component developer (except sometimes for critical systems) </li></ul></ul><ul><ul><li>Tests are derived from the developer’s experience </li></ul></ul><ul><li>Integration testing </li></ul><ul><ul><li>Testing of groups of components integrated to create a system or sub-system </li></ul></ul><ul><ul><li>The responsibility of an independent testing team </li></ul></ul><ul><ul><li>Tests are based on a system specification </li></ul></ul>Integration of components
  7. 7. Integration of components
  8. 8. Integration of components: test process is the same
  9. 9. <ul><li>The entire system is viewed as a collection of subsystems (sets of classes) determined during the system and object design. </li></ul><ul><li>The order in which the subsystems are selected for testing and integration determines the testing strategy </li></ul><ul><ul><li>Big bang integration (Nonincremental) </li></ul></ul><ul><ul><li>Bottom up integration </li></ul></ul><ul><ul><li>Top down integration </li></ul></ul><ul><ul><li>Sandwich testing </li></ul></ul><ul><ul><li>Variations of the above </li></ul></ul><ul><li>For the selection use the system decomposition from the System Design </li></ul>Integration Testing Strategy
  10. 10. Example Design Structure: Three Layer Call Hierarchy A B C D G F E Layer I Layer II Layer III
  11. 11. Unit Test F Unit Test E Unit Test D Unit Test C Unit Test B Unit Test A Not recommended in all but the simplest systems! Integration Testing: Big-Bang Approach System Test
  12. 12. <ul><li>The subsystem in the lowest layer of the call hierarchy are tested individually </li></ul><ul><li>Then the next subsystems are tested that call the previously tested subsystems </li></ul><ul><li>This is done repeatedly until all subsystems are included in the testing </li></ul><ul><li>Special program needed to do the testing, Test Driver : </li></ul><ul><ul><li>A routine that calls a subsystem and passes a test case to it </li></ul></ul>Bottom-up Testing Strategy
  13. 13. Unit Test F Unit Test E Unit Test G Unit Test C Bottom-up Integration Require Driver: B Requires Driver: A Requires Driver: G A B C D G F E Layer I Layer II Layer III Test D,G Test B, E, F Test A, B, C, D, E, F, G
  14. 14. <ul><li>Bad for functionally decomposed systems: </li></ul><ul><ul><li>Tests the most important subsystem (UI) last </li></ul></ul><ul><li>Useful for integrating the following systems </li></ul><ul><ul><li>Object-oriented systems </li></ul></ul><ul><ul><li>real-time systems </li></ul></ul><ul><ul><li>systems with strict performance requirements </li></ul></ul>Advantages and Disadvantages of bottom-up integration testing
  15. 15. <ul><li>Test the top layer or the controlling subsystem first </li></ul><ul><li>Then combine all the subsystems that are called by the tested subsystems and test the resulting collection of subsystems </li></ul><ul><li>Do this until all subsystems are incorporated into the test </li></ul><ul><li>Special program is needed to do the testing, Test stub : </li></ul><ul><ul><li>A program or a method that simulates the activity of a missing subsystem by answering to the calling sequence of the calling subsystem and returning back fake data. </li></ul></ul>Top-down Testing Strategy
  16. 16. Test A Layer I Top-down Integration Testing Requires stubs: B C D E F G A B C D G F E Layer I Layer II Layer III Test A, B, C, D Layer I + II Test A, B, C, D, E, F, G All Layers
  17. 17. <ul><li>Test cases can be defined in terms of the functionality of the system (functional requirements) </li></ul><ul><li>Writing stubs can be difficult: Stubs must allow all possible conditions to be tested. </li></ul><ul><li>Possibly a very large number of stubs may be required, especially if the lowest level of the system contains many methods. </li></ul><ul><li>One solution to avoid too many stubs: Modified top-down testing strategy </li></ul><ul><ul><li>Test each layer of the system decomposition individually before merging the layers </li></ul></ul><ul><ul><li>Disadvantage of modified top-down testing: Both, stubs and drivers are needed </li></ul></ul>Advantages and Disadvantages of top-down integration testing
  18. 18. <ul><li>Combines top-down strategy with bottom-up strategy </li></ul><ul><li>The system is view as having three layers </li></ul><ul><ul><li>A target layer ‘somewhere in the middle’ </li></ul></ul><ul><ul><li>A layer above the target </li></ul></ul><ul><ul><li>A layer below the target </li></ul></ul><ul><ul><li>Testing converges at the target layer </li></ul></ul><ul><li>How do you select the target layer if there are more than 3 layers? </li></ul><ul><ul><li>Heuristic: Try to minimize the number of stubs and drivers </li></ul></ul>Sandwich Testing Strategy
  19. 19. Test E Test A, B, C, D, E, F, G Test A,B,C, D Sandwich Testing Strategy A B C D G F E Layer I Layer II Layer III Test D,G Test B, E, F Test F Test G Test A Bottom Layer Tests Top Layer Tests
  20. 20. <ul><li>Top and Bottom Layer Tests can be done in parallel </li></ul><ul><li>Does not test the individual subsystems thoroughly before integration </li></ul><ul><li>Solution: m odified sandwich testing strategy: </li></ul><ul><ul><li>Test in parallel: </li></ul></ul><ul><ul><ul><li>Middle layer with drivers and stubs </li></ul></ul></ul><ul><ul><ul><li>Top layer with stubs </li></ul></ul></ul><ul><ul><ul><li>Bottom layer with drivers </li></ul></ul></ul><ul><ul><li>Test in parallel: </li></ul></ul><ul><ul><ul><li>Top layer accessing middle layer (top layer replaces drivers) </li></ul></ul></ul><ul><ul><ul><li>Bottom accessed by middle layer (bottom layer replaces stubs) </li></ul></ul></ul>Advantages and Disadvantages of Sandwich Testing
  21. 21. Modified Sandwich Testing Strategy A B C D G F E Layer I Layer II Layer III Test F Test E Test B Test G Test D Test A Test C Test B, E, F Triple Test I Triple Test I Test D,G Double Test II Double Test II Double Test I Double Test I Test A,C Test A, B, C, D, E, F, G
  22. 22. <ul><li>1. Based on the integration strategy, select a component to be tested. Unit test all the classes in the component. </li></ul><ul><li>2. Put selected component together; do any preliminary fix-up necessary to make the integration test operational (drivers, stubs) </li></ul><ul><li>3. Do functional testing: Define test cases that exercise all uses cases with the selected component </li></ul><ul><li>4. Do structural testing: Define test cases that exercise the selected component </li></ul><ul><li>5. Execute performance tests </li></ul><ul><li>6. Keep records of the test cases and testing activities. </li></ul><ul><li>7. Repeat steps 1 to 7 until the full system is tested. </li></ul><ul><li>The primary goal of integration testing is to identify errors in the (current) component configuration. </li></ul>. Steps in Integration-Testing
  23. 23. <ul><li>Factors to consider </li></ul><ul><ul><li>Amount of test harness (stubs &drivers) </li></ul></ul><ul><ul><li>Location of critical parts in the system </li></ul></ul><ul><ul><li>Availability of hardware </li></ul></ul><ul><ul><li>Availability of components </li></ul></ul><ul><ul><li>Scheduling concerns </li></ul></ul><ul><li>Bottom up approach </li></ul><ul><ul><li>good for object oriented design methodologies </li></ul></ul><ul><ul><li>Test driver interfaces must match component interfaces </li></ul></ul><ul><ul><li>... </li></ul></ul><ul><ul><li>...Top-level components are usually important and cannot be neglected up to the end of testing </li></ul></ul><ul><ul><li>Detection of design errors postponed until end of testing </li></ul></ul><ul><li>Top down approach </li></ul><ul><ul><li>Test cases can be defined in terms of functions examined </li></ul></ul><ul><ul><li>Need to maintain correctness of test stubs </li></ul></ul><ul><ul><li>Writing stubs can be difficult </li></ul></ul>Choosing an Integration Strategy?
  24. 24. Establish the test objectives Design the test cases Write the test cases Test the test cases Execute the tests Evaluate the test results Change the system Do regression testing Remember the Testing Life Cycle
  25. 25. Test Analyst Team User Programmer too familiar with code Professional Tester Configuration Management Specialist System Designer How to Construct a Good Test Team?
  26. 26. In a complex system, you will probably need a test bench to co-ordinate testing activities
  27. 27. (OO) Integration Testing Lets learn about integration testing by looking at a practical example: <ul><li>Check out the Source Code at the web site </li></ul><ul><li>We will use the IntPairArray from the regression testing exercise: </li></ul><ul><li>IntPair.java, </li></ul><ul><ul><ul><ul><li>Compare.java, </li></ul></ul></ul></ul><ul><ul><ul><ul><li>IntPairArray.java, </li></ul></ul></ul></ul><ul><li>in our new system: Integration.java </li></ul><ul><li>It is your task to compare and contrast 2 different integration testing approaches (e.g. big bang vs bottom-up ) for this System. </li></ul>