UPI Study › Courses › System Analysis and Design › Free lessons › Lesson 7.4 Free with a free account
Integration Testing: Combining Modules and Validating Their Interactions Step by Step
System Analysis and Design · Chapter 7: Implementation, Testing, and MaintenanceSection 7.4 · lesson 49 of 697 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of System Analysis and Design.
Lesson complete
Earn the 3 college credits for System Analysis and Design
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Verification in the SDLC: Confirming the System Meets Requirements and Design Specifications →← Programming Essentials: Writing, Testing, and Debugging CodeNext lesson: Verification in the SDLC: Confirming the System Meets Requirements and Design Specifications →
In this lesson
Combining modules, and validating how they interact, step by step.
- Explain why integration testing is needed after unit testing
- Compare big bang, top-down, bottom-up, and sandwich integration
- Explain stubs and drivers, and what interface testing checks
- Apply top-down and bottom-up integration to a worked example
Transcript
Everything said in the video, section by section (984 words). Read along, or search it.
Implementation, Testing, and Maintenance
Integration Testing
Every module can pass its own tests, and the system can still fail. This section is about integration testing, which checks what happens when modules are put together. We will compare four ways of combining them, meet the stubs and drivers that stand in for missing modules, and look at interface testing. Then we will apply it all to a worked example, a checkout system.
Why It Matters
Correct Alone, Broken Together
Unit testing confirms that a single module works correctly on its own. It does not confirm that two modules work correctly together. A module can pass every unit test, and still fail once it is connected to another one. The two might disagree about the format of the data passed between them. They might disagree about the order in which they expect to be called. Or about how errors should be reported across the boundary. Integration testing exists specifically to catch the problems that only appear once modules are combined.
4 Strategies
In What Order Do Modules Combine?
There is more than one way to decide the order in which modules are combined and tested. Four approaches cover most real projects. Big bang integration combines every module at once, and tests them together as a complete system. It is simple to set up. But when something fails, the cause could be any module, or any interaction between them, so it is hard to isolate. Top-down integration starts with the highest-level module, and works downward. Lower-level modules that are not yet integrated are replaced with stubs. Bottom-up integration starts with the lowest-level modules, and works upward. Higher-level modules that are not yet integrated are simulated with drivers. And sandwich, or hybrid, integration does both at the same time, working toward the middle from both directions.
Stand-Ins
Stubs and Drivers
Top-down and bottom-up both need something to stand in for a module that is not integrated yet. But they need it in opposite directions. A stub stands in for a lower-level module. It is used when testing top-down, and it is called by the module under test. A driver stands in for a higher-level module. It is used when testing bottom-up, and it calls the module under test. A stub is usually a simplified piece of code that returns a canned, predictable response, instead of doing real work. It does just enough for the module calling it to keep running. A driver is a small test harness. It calls the module under test with specific inputs, and checks what comes back. It stands in for a caller that does not exist yet. One way to remember it. A stub gets called. A driver does the calling.
Interface Testing
Testing the Boundary
Interface testing focuses on the boundary between two modules, rather than on what either module does inside. It checks three things. That data passed between modules is in the format both sides expect. That modules call each other in the correct order. And that errors raised on one side of the boundary are handled correctly on the other. Here is how a module can pass every unit test, and still fail interface testing. It expects a date formatted one way, while the module calling it sends a date formatted another way. Unit testing never sees that mismatch, because it only checks the module's own internal logic.
Figure 1
Worked Example: A Checkout System
Here is the worked example, a simplified checkout system. At the top, a checkout controller coordinates two modules, a payment processor and an inventory manager. The payment processor depends on a payment gateway client, and a tax calculator. The inventory manager depends on a stock database client, and a shipping calculator. Top-down integration starts at the checkout controller and works downward, stubbing out lower modules that are not yet integrated. Bottom-up integration starts at the four leaf modules, along the bottom, and works upward, using drivers in place of the modules that would normally call them.
Applied Top-Down
From the Controller Down
Applied top-down, testing begins with the checkout controller alone. It calls stubs standing in for the payment processor and the inventory manager. Once that works, the payment processor is integrated for real. It, in turn, still calls stubs for the payment gateway client and the tax calculator. And so on down the tree, replacing each stub with the real module, one at a time. This is exactly why incremental integration is easier to debug than big bang. Only one module is added at a time. So a new failure can usually be traced to the module that was just added.
Applied Bottom-Up
From the Leaves Up
Applied bottom-up, the order reverses. Testing begins with the four leaf modules, individually. The payment gateway client, the tax calculator, the stock database client, and the shipping calculator. No real higher-level module exists yet to call them, so each is called by a driver that feeds it test inputs. Once each leaf module is confirmed working, the payment processor and inventory manager are integrated with their real leaf modules. Finally, the checkout controller is integrated on top, completing the system.
Key Terms
The Vocabulary of This Section
Let's lock in the key terms. Integration testing verifies that modules work correctly together, after each has already passed unit testing on its own. A stub is a simplified placeholder for a lower-level module not yet integrated. It is called by the module under test. A driver is a test harness standing in for a higher-level module not yet integrated. It calls the module under test. Interface testing focuses on the boundary between two modules, rather than on either module's internal logic. Big bang integration combines everything at once. Sandwich integration combines top-down and bottom-up.
Key Takeaways
What to Carry Forward
To pull this together. Integration testing catches problems that only appear once individually correct modules are combined. Big bang is simple to set up but hard to debug. Top-down and bottom-up integrate incrementally, in opposite directions. Sandwich does both at once. Stubs stand in for lower-level modules in top-down testing. Drivers stand in for higher-level modules in bottom-up testing. And interface testing checks the boundary between modules, such as data format and call order, which unit testing does not cover.
About System Analysis and Design at UPI Study
System Analysis and Design (Computer Science 390) is a self-paced online course of 69 video lessons in 9 chapters, from the analyst's role and requirements to UML modeling, interface and database design, testing, maintenance and project management. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Why take it here
Why students take System Analysis and Design with UPI Study
Where the credit goes
Universities that work with NCCRS
System Analysis and Design carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Integration Testing: Combining Modules and Validating Their Interactions Step by Step
Why is integration testing needed if every module passes unit testing?
What is the difference between a stub and a driver in integration testing?
What are big bang, top-down, bottom-up, and sandwich integration?
What does interface testing check?
About the System Analysis and Design course
How many college credits is System Analysis and Design?
How much does System Analysis and Design cost and what is included?
Which universities accept UPI Study credits?
How long does System Analysis and Design take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in System Analysis and Design.
69 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
3 credits · NCCRSEnroll →