---
title: "Top-down integration problems; regression testing"
subject: "Software Engineering"
chapter: 8
key: "semester_5/software_engineering:top-down-integration-regression"
source: https://www.bctengineer.com/q/semester_5/software_engineering/top-down-integration-regression
site: BCT Engineering
---

# Top-down integration problems; regression testing

Software Engineering · Chapter 8: Software Testing and cost Estimation

- Asked in: 2068 Baishakh (old course), 10 marks; year not given, 10 marks
- Video: [Integration Testing with examples | Software Engineering](https://www.youtube.com/watch?v=p8vrpGMR3g4) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/software_engineering/top-down-integration-regression
- Whole chapter: https://www.bctengineer.com/md/semester_5/software_engineering/chapter-8

## Question

What problems may be encountered when top down integration is chosen? What is regression testing?

## Short answer

Top-down integration suffers from costly stubs, delayed testing of low-level modules, inadequate upper-level testing, hard-to-observe outputs, and limited parallel work. Regression testing re-executes a subset of previous tests after any change to ensure it did not break existing functions or reintroduce old errors.

## Answer

#### Problems with top-down integration

In **top-down integration**, modules are integrated by moving downward through the control hierarchy, starting with the main control module. Lower-level modules that are not ready are replaced by **stubs** (dummy modules that simulate them). Integration can be depth-first or breadth-first.

```text
              M1   (main, tested first)
            /  |  \
          M2   M3   M4     <- stubs at first
         /  \        |
       M5    M6      M7    <- integrated last
```

Testing M1 first needs stubs S2, S3 and S4. Each stub is then replaced by the real module, one at a time, and tests are rerun. The following problems may be encountered:

1. **Stubs are costly and hard to write.** A stub must return realistic values for the calling module to be tested properly. For complex modules (e.g. a database or a calculation engine) a realistic stub is almost a full module, which adds large overhead.
2. **Upper levels cannot be fully tested without lower-level processing.** Often the real data that flows upward is produced only by low-level modules. If stubs return simple values, upper-level logic is not tested adequately. The tester then has three poor choices:
   - delay many tests until stubs are replaced by real modules, which loses the link between a test and a specific module and makes error location hard;
   - write more capable stubs, which costs much effort;
   - change to bottom-up integration for that part.
3. **Low-level modules are tested late.** Critical utility modules (input/output, device drivers, maths routines) are at the bottom and are integrated last. Errors in them are found late, when they are expensive to fix.
4. **Test output is hard to observe.** Upper-level modules often do not produce visible results directly; outputs may be produced only by lower modules. Extra code may be needed to observe results.
5. **Hard to create test conditions.** Some situations are produced only by low-level modules (such as a hardware error), so they are hard to trigger from the top.
6. **Temptation to defer testing.** Because of the effort above, testers may postpone tests, and some combinations are never tested.
7. **Parallel work is limited.** Lower modules may be ready before upper modules, but they cannot be integrated until the upper layers exist.

The advantage that balances these problems is that major control and decision points are checked early, and a working skeleton of the system is available early for demonstration. In practice a **sandwich (mixed)** approach is often used.

#### Regression testing

**Regression testing** is re-executing a subset of previously run tests after a change to the software, to make sure the change has not introduced new errors or brought back old ones in parts that used to work.

Every time a new module is added during integration, or a bug is fixed or a feature added during maintenance, the program changes. New data flow paths, new I/O and new control logic may break existing functions. Regression testing catches these side effects.

The regression test suite usually contains three classes of tests (Pressman):
1. A representative sample of tests that exercise all software functions.
2. Additional tests that focus on functions likely to be affected by the change.
3. Tests that focus on the components that were changed.

Approaches: **retest all** (safe but costly), **selective regression** (only affected tests), and **prioritised regression** (most important tests first). Because tests are run again and again, they are usually **automated** with tools such as JUnit or Selenium in a continuous integration pipeline.

**Example:** in an online shop, the discount calculation is changed. Regression testing re-runs the cart total, tax, payment and invoice tests to make sure they still give correct results.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is a stub in top-down integration?
   A. A dummy module that simulates a lower-level module not yet ready
   B. A driver that calls modules from below
   C. The main control module
   D. A final test report
   Answer: A. Top-down starts at the main module and replaces unfinished lower modules with stubs that return values. (Key point: Stubs)

2. Which is a key problem of top-down integration?
   A. Control modules are tested too late
   B. Realistic stubs are costly, and upper levels are hard to test without lower-level processing
   C. No stubs are ever needed
   D. Low-level modules are tested first
   Answer: B. Stubs must return realistic data, and upper-level logic is poorly tested if stubs are simple. Options then are delaying tests, writing better stubs or switching to bottom-up. (Key point: Main problem)

3. Why are errors in utility modules like I/O drivers found late in top-down integration?
   A. They are integrated last at the bottom of the hierarchy
   B. They are never tested
   C. They are tested before the main module
   D. They contain no errors
   Answer: A. Bottom-level modules are integrated last, so errors in them are found late when they cost more. (Key point: Late testing of low-level modules)

4. What is regression testing?
   A. Testing a new product for the first time
   B. Re-running earlier tests after a change to ensure no new errors or old errors reappear
   C. Testing only the changed lines
   D. Testing performance under load
   Answer: B. After changes such as adding a module or fixing a bug, a subset of earlier tests is re-run to catch side effects. (Key point: Regression testing)

## Related in Software Engineering

- [Regression testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aregression-testing) — Software Engineering, chapter 8
- [Failure after acceptance testing; integration testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Afail-after-acceptance) — Software Engineering, chapter 8
- [Component, integration and release testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Acomponent-release-integration) — Software Engineering, chapter 8
- [Top-down approach](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Atop-down-approach) — Software Engineering, chapter 3
- [CMMI levels and the top two levels](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Acmmi-levels) — Software Engineering, chapter 9

## Related in other subjects

- [Top-down view for F = xz + yz'](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Apositive-photoresist-topdown-xz-yzbar) — Embedded System, chapter 8
- [IC manufacturing steps; top-down F = xz + y](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Aic-manufacturing-steps-topdown-xz-y) — Embedded System, chapter 8
- [PET by Penman's method, Dang in May](https://www.bctengineer.com/question.md?key=semester_5%2Fengineering_hydrology%3Apenman-dang-may) — Engineering Hydrology, chapter 3
