Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 2.2: Structural Testing (Part 1)

Lesson 8 of 16 in the free Software Testing notes on Siksha Sarovar, written by Rohit Jangra.

Unit 2.2: White Box Testing Fundamentals

1. Structural Testing (White Box Testing)

Definition: White Box Testing (also called Glass Box, Clear Box, or Structural Testing) is a method where the internal code structure is known to the tester. The tester validates the system by checking the actual logic pathways.

Why "White/Glass Box"? The box is transparent. You can see the variables, loops, and logic branches inside.

Need for White Box Testing: Black box testing can tell you that a feature failed, but White Box testing tells you why and where. It is essential only to:

  1. Verify Logic: Ensure all logical decisions (True/False) are tested.
  2. Find Hidden Errors: Such as memory leaks, uninitialized variables, or dead code that black box testing might miss.
  3. Optimize Code: Removing redundant lines or inefficient loops.

Static vs Dynamic White Box:

  • Static: Code Review, Walkthrough (Reading code).
  • Dynamic: Unit Testing (Running code with inputs).

---

2. Path Testing and Basic Path Testing

Definition: Path testing is a structural testing method that involves using the source code of a program to find every possible executable path.

Concept of "Independent Path": An independent path is any path through the program that introduces at least one new set of processing statements or a new condition.

  • Ideally, we want to test all independent paths (Basis Path Testing).
  • If we test all independent paths, we guarantee that every statement and every branch has been executed at least once.

Coverage Criteria Hierarchy:

  1. Statement Coverage: Execute every line of code. (Weakest).
  2. Branch Coverage: Execute every "True" and "False" side of an if. (Better).
  3. Path Coverage: Execute every unique route through the code. (Best).

---

3. DD-Paths (Decision-to-Decision Paths)

Definition: A DD-Path is a sequence of statements that, once entered, must be executed to completion. It represents a single node in a Control Flow Graph (CFG).

Why do we need it? Real code is messy. DD-Paths simplify code into a clean graph model (Nodes and Edges) which allows us to calculate complexity mathematically.

Characteristics:

  • It starts at an entry node or decision node.
  • It ends at an exit node or decision node.
  • It contains no internal branching (no 'if' or 'while' inside the path itself).