#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Levels of Testing

Integration Testing

What is Integration Testing?

Integration testing verifies that individual modules or units work correctly together when combined, focusing on the interfaces and data flow between them.

Common Approaches

  • Big Bang Integration: All modules are combined at once and tested together.
  • Top-Down Integration: Testing starts from top-level modules, using stubs for lower-level modules not yet developed.
  • Bottom-Up Integration: Testing starts from lower-level modules, using drivers to simulate higher-level modules.
  • Sandwich/Hybrid Integration: Combines both top-down and bottom-up approaches.

Why It Matters

Even if individual units pass their own tests, problems in how they communicate — mismatched data formats, incorrect API calls, timing issues — can only be caught once modules are integrated.

Planning Integration Tests Step by Step

  1. Map the interfaces. List every point where modules talk: function calls, REST APIs, message queues, shared database tables and files.
  2. Pick an approach and an order. Decide whether to go top-down, bottom-up or hybrid, and which pairs of modules to join first. Critical or risky interfaces usually go early.
  3. Identify missing pieces. Where a module is not ready, plan a stub or a driver to stand in for it.
  4. Write test cases per interface. Cover valid data, invalid data, empty responses, timeouts and errors coming back from the other side.
  5. Prepare shared test data that both modules agree on, such as a known customer and product.
  6. Execute, log and retest. When a defect is fixed, rerun the interface tests and a regression set around it.

Stubs and Drivers in Practice

A stub replaces a lower module that is called by the module under test. A driver replaces a higher module that calls it. Picture an order service that calls a payment gateway not yet available for testing. A stub with predictable answers lets the team test the integration logic now.

class PaymentGatewayStub:
    def charge(self, amount, card_token):
        if amount <= 0:
            return {"status": "FAILED", "reason": "invalid amount"}
        if card_token == "tok_declined":
            return {"status": "DECLINED"}
        return {"status": "SUCCESS", "txn_id": "TEST123"}


def test_order_is_paid_when_charge_succeeds():
    service = OrderService(payment_gateway=PaymentGatewayStub())
    order = service.place_order(item_id=7, amount=499, card_token="tok_ok")
    assert order.status == "PAID"
    assert order.txn_id == "TEST123"


def test_order_stays_pending_when_card_declined():
    service = OrderService(payment_gateway=PaymentGatewayStub())
    order = service.place_order(item_id=7, amount=499, card_token="tok_declined")
    assert order.status == "PAYMENT_FAILED"

Once the real gateway sandbox is ready, the same tests run against it to confirm the actual contract matches what the stub assumed.

What to Check at Each Interface

InterfaceTypical checks
UI to APIForm fields map to the right request fields, errors from the API are shown clearly
Service to serviceField names, data types, date and currency formats, behaviour on timeouts
Service to databaseRecords saved with correct values, transactions roll back on failure
Message queueMessages published once, consumer handles duplicates and bad messages
File exchangeFile naming, encoding, header rows, partial files

Component and system integration

Component integration testing joins modules inside one application. System integration testing joins your application with external systems such as a bank, an SMS provider or a partner's API, where you control only one side.

Mistakes That Weaken Integration Testing

  • Mocking every dependency, so the tests become unit tests and real mismatches slip through.
  • Testing only success responses, while real failures come from timeouts, retries and unexpected error bodies.
  • Skipping integration because each team's unit tests pass, then finding format mismatches late.
  • Sharing one database between test runs without cleanup, causing random failures.

Quick checklist: interface list complete, stubs documented, negative cases included, test data agreed, and real-system runs scheduled once dependencies are available.

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course