- Testing Strategies
- A Strategic Approach To Software Testing
- Test Strategies for Conventional Software
- Black-Box and White-Box Testing
- Validation Testing
- System Testing
- The Art of Debugging
- Product Metrics
- Software Quality
- Metrics for Analysis Model
- Metrics for Design Model
- Metrics for Source Code
- Metrics for Testing
- Metrics for Maintenance
Test Strategies for Conventional Software
For conventional software, a structured and systematic approach to testing is crucial to ensure quality and functionality. Test strategies for conventional software typically involve a phased approach, starting with the testing of individual program units and progressively integrating them to form the complete system. This incremental methodology helps in identifying defects at early stages, making them easier and less costly to fix.
Unit Testing
Unit Testing is the initial and most granular level of testing in the software development process. Its primary focus is to verify the correctness of individual components or modules of the software in isolation. A “unit” can refer to the smallest testable part of an application, such as a function, method, procedure, or class.
Purpose of Unit Testing
The main purpose of unit testing is to:
- Isolate each part of the program and show that individual parts are correct.
- Verify that each module functions as per its design specifications.
- Facilitate early detection of defects, as issues are caught within a single unit rather than later when integrated with other components.
Strategies for Unit Testing
Unit testing can employ different strategies depending on the project’s architecture and preferences:
- Top-down Unit Testing: In this approach, higher-level modules are tested first. Lower-level dependent modules are replaced by “stubs,” which are dummy programs that simulate the functionality of the actual lower-level modules. This method is useful when the overall system structure is clear early on.
- Bottom-up Unit Testing: This strategy involves testing the lowest-level modules first. As these modules are verified, they are then used to test higher-level modules. “Drivers,” which are temporary programs that simulate the calls from higher-level modules, are used to provide input and control to the modules being tested. This approach is effective when the foundational components are critical.
- Big Bang Unit Testing: This is a less common and generally discouraged unit testing strategy where all modules are developed and then combined all at once for testing. While it saves the overhead of creating drivers and stubs, defect localization becomes extremely difficult because the entire system is tested as a single unit, making it hard to pinpoint which module caused a failure.
Types of Unit Testing
While the strategies define the order of testing, unit tests themselves can be various types:
- Structural Testing: Focuses on the internal structure and logic of the unit (similar to white-box testing at a unit level).
- Functional Testing: Verifies the external behavior of the unit against its specified requirements.
Advantages of Unit Testing
- Early Bug Detection: Bugs are detected at an early stage of development when they are easier and cheaper to fix.
- Easier Debugging: Since only a small part of the code is being tested, it’s easier to locate and fix the exact source of a defect.
- Improved Code Quality: Encourages developers to write modular, well-structured, and testable code.
- Facilitates Change: Makes it safer to refactor or change code, as unit tests can immediately flag if a change breaks existing functionality.
Disadvantages of Unit Testing
- Time-Consuming: Writing and maintaining unit tests can take significant time and effort.
- Requires Test Harness: Often requires the creation of drivers (simulating calling modules) and stubs (simulating called modules), which adds overhead.
- Limited Scope: Cannot detect integration errors or system-level issues that arise when units interact.
Integration Testing
Integration Testing follows unit testing and focuses on verifying the interactions and interfaces between integrated modules or components of a software system. The goal is to ensure that combined units work together as expected and that data flows correctly between them.
Importance of Integration Testing
- Uncovers Interface Defects: Reveals errors that occur when different modules or services interact.
- Ensures Data Flow: Verifies that data is passed correctly from one module to another.
- Builds Confidence: Increases confidence in the system’s ability to function as a cohesive whole.
Integration Testing Approaches
Incremental Integration Testing: This is the preferred approach for most conventional software. Modules are integrated one by one, allowing for early detection and isolation of interface errors. This approach makes debugging easier compared to testing everything at once.
- Top-Down Incremental Integration: Modules are integrated from top to bottom of the control hierarchy. Stubs are used for lower-level modules that are not yet developed or integrated.
- Bottom-Up Incremental Integration: Integration begins with the lowest-level modules, and as they are tested and integrated, they move up the hierarchy. Drivers are used to simulate calls from higher-level modules.
- Mixed (Sandwich) Integration: Combines both top-down and bottom-up approaches, integrating from the middle layer outwards.
Advantages of Incremental Process Model:
- Easier and faster defect localization because each integration step is small.
- Thorough testing of interfaces as they are integrated one by one.
- Continuous progress tracking is possible.
Disadvantages of Incremental Process Model:
- Can be resource-intensive due to the need for drivers and stubs in certain approaches.
- Requires careful planning and management to ensure proper integration order.
Non-Incremental Integration Testing (Big Bang Integration): In this approach, all modules are first developed and unit-tested in isolation. Then, they are all combined and integrated at once, and the entire system is tested as a single entity.
Disadvantages of Non-Incremental Integration:
- Difficult Defect Localization: If a defect is found, it becomes very challenging to identify which specific interface or module interaction caused the problem due to the large number of integrated components.
- Increased Risk: Many critical defects may be discovered late in the cycle, leading to increased rework and project delays.
Â