| Aspect | Static Testing | Dynamic Testing |
|---|---|---|
| Execution | Code is not executed | Code is executed |
| Performed In | Early stages of the SDLC | Later stages of the SDLC |
| Detects | Defects in documents, design, or source code | Defects in the working application |
| Techniques | Reviews, inspections, static analysis | Unit, integration, system, and UAT |
| Cost | Cheaper because defects are caught early | Costlier if defects are found late |
Topic: Static Testing vs Dynamic Testing
Static Testing
- Testing without executing the code.
- Goal: find defects early in requirements, design, or code artifacts.
- Performed through reviews, walkthroughs, inspections, and static analysis tools.
- Helps catch issues before they become harder and costlier to fix.
Examples
- Requirement review meetings to validate completeness and clarity.
- Code review using tools such as SonarQube to flag potential defects.
- Checking for missing or outdated documentation.
Dynamic Testing
- Testing that involves executing the software.
- Goal: validate behavior, functionality, and user workflows in a running application.
- Includes functional, integration, system, and performance testing activities.
- Reveals defects that only appear during runtime and real usage.
Examples
- Running Selenium test scripts against the UI.
- Executing API test suites in Postman to verify responses.
- Load testing with JMeter to assess performance under stress.
Key Differences
Why Both Are Needed
- Static testing catches defects early when they are cheaper to fix.
- Dynamic testing validates real execution paths and end-user scenarios.
- Using both approaches improves quality and reduces overall cost and risk.