Sample question 1 — Testing Throughout the Software Development Lifecycle
A developer writes a new pricing module and wants to test it in isolation before it is integrated with the rest of the order system. The module depends on a database that does not yet exist. Which test level and supporting mechanism are most appropriate?
- A. System testing, because the whole order system must run to exercise the module.
- B. Integration testing, because the module must be connected to the database before any test can run.
- C. Acceptance testing, because the module must be validated by the end user first.
- D. Component testing, using a driver or stub to replace the missing database dependency.
Answer: D. Option D is correct. Component testing exercises an individual unit in isolation, and stubs or drivers replace the missing dependencies such as the database, which is what allows the module to be tested early. Option C is incorrect because acceptance testing validates the system against user needs, not an isolated module. Option A is incorrect because system testing requires the whole system, not one component. Option B is incorrect because integration testing focuses on the interfaces between components, and a stub lets the module be tested before the database exists.
