5.1 Coding Standards and Guidelines
Coding Standards establish uniform rules and style conventions across an organization to enhance code readability, maintainability, and review velocity.
- Naming Conventions: camelCase for variables/methods, PascalCase for classes, UPPER_SNAKE_CASE for constants.
- Refactoring & Complexity Bounds: Keeping cyclomatic complexity low; enforcing maximum line and function lengths.
- Error Handling Discipline: Banning empty catch blocks; avoiding mutable global state.
5.2 Software Testing Fundamentals: Verification vs Validation
Testing systematically executes programs under controlled conditions to discover defects before customers encounter them in production.
Boehm's Foundational Testing Axiom:
Verification: "Are we building the product RIGHT?" (Static inspection & adherence to specification).
Validation: "Are we building the RIGHT product?" (Dynamic execution proving fitness for customer needs).
5.3 Levels of Testing: The Test Pyramid
Testing is staged across four hierarchical levels to catch defects at the lowest possible cost:
Figure 5.1: The Testing Pyramid demonstrates that the bulk of automated test suites should consist of fast, low-cost Unit Tests.
5.4 Testing Techniques: Black-Box vs White-Box
Test design techniques are broadly divided into functional (black-box) and structural (white-box) paradigms:
Figure 5.2: Black-box validates external inputs against outputs; White-box verifies internal control flow paths.
5.5 Test Case Design
A Test Case is a formalized set of conditions, inputs, execution steps, and expected outputs designed to verify a particular functional or non-functional requirement.
| Attribute | Industry Purpose & Example |
|---|---|
| Test Case ID | Unique identifier for traceability (e.g. TC_AUTH_001). |
| Preconditions | System state required before test execution (e.g. User account exists in DB and is active). |
| Test Steps & Data | Numbered sequence of actions performed with concrete payload data. |
| Expected vs Actual | Expected outcome compared against observed outcome to determine Pass/Fail status. |