Integration Testing: Combining Modules and Validating Their Interactions Step by Step

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

← Programming Essentials: Writing, Testing, and Debugging CodeNext lesson: Verification in the SDLC: Confirming the System Meets Requirements and Design Specifications →

Earn 3 college credits for System Analysis and DesignRecommended for credit by NCCRS · Computer Science 390 · self-paced · one payment, lifetime access

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.

Compare: Software Engineering vs Systems Analysis

Why take it here

Why students take System Analysis and Design with UPI Study

From business problem to working systemSystem Analysis and Design teaches how analysts study a business need and turn it into a system design: requirements, UML and data-flow models, interface and database design, implementation and project management. It is a core course in information systems and IT degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

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.

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?
Integration testing is needed because modules that work correctly alone can still fail once they are connected. Unit testing checks a module's internal logic, not how it cooperates with others. Two modules might disagree about the format of the data passed between them, the order in which they are called, or how errors are reported across the boundary. Integration testing exists to catch exactly those problems.
What is the difference between a stub and a driver in integration testing?
A stub stands in for a lower-level module and gets called, while a driver stands in for a higher-level module and does the calling. Stubs are used in top-down integration and usually return a canned, predictable response so the module above can keep running. Drivers are small test harnesses used in bottom-up integration that feed specific inputs to the module under test and check the results.
What are big bang, top-down, bottom-up, and sandwich integration?
They are four orders for combining modules during integration testing. Big bang combines every module at once, which is simple to set up but makes failures hard to trace. Top-down starts at the highest-level module and works down using stubs. Bottom-up starts at the lowest-level modules and works up using drivers. Sandwich, or hybrid, integration works from both ends toward the middle at the same time.
What does interface testing check?
Interface testing checks the boundary between two modules rather than what either module does inside. It confirms that data passed between them is in the format both sides expect, that they call each other in the correct order, and that errors raised on one side are handled properly on the other. For example, one module may send a date in a format its partner does not accept.

About the System Analysis and Design course

How many college credits is System Analysis and Design?
System Analysis and Design (Computer Science 390) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does System Analysis and Design cost and what is included?
$250, paid once, with lifetime access: all 69 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does System Analysis and Design take?
It is self-paced with no deadlines. The 69 lessons total about 9 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

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.

System Analysis and Design
3 credits · NCCRS
Enroll →