› Module 5: Coding and Software Testing › 5.3 Levels of Testing: The Test Pyramid
M O D U L E

Module 5: Coding and Software Testing

Coding standards, testing fundamentals, verification vs validation, testing pyramid, black vs white-box, and test cases

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: Software Testing Levels (The Testing Pyramid) Acceptance Testing (UAT) System Testing (End-to-End Compliance) Integration Testing (Interface & API Interactions) Unit Testing (Functions, Methods, Isolated Classes)

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 vs White-Box Testing Techniques Black-Box Testing • Tests functionality against requirements • Internal source code is completely invisible • Equivalence Partitioning & Boundary Value • Decision Table & State Transition Testing White-Box Testing • Tests internal logic, loops, and branching paths • Full visibility into source code and data structures • Statement, Branch, Condition Coverage • Basis Path Testing & Mutation Testing

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.
MODULE COMPREHENSIVE QUIZ

Module 5 Final Quiz

Test your understanding across all 5 topics of this module with interview-grade questions, tricky edge cases, and code output predictions.

Take Module 5 Final Quiz →
Yukti Mascot