TU BCA Software Engineering Master Guide: Black-Box vs White-Box Testing, Cyclomatic Complexity & SQA Models
Author: Bhuban Subedi | Subject: Software Engineering (CACS252) | Semester: Fourth Semester
In commercial software development, delivering robust, defect-free code requires systematic verification, validation, and software quality assurance (SQA) frameworks. In the Tribhuvan University BCA fourth semester, Software Engineering (CACS252) trains students in the engineering discipline of software construction, architectural modeling, automated testing strategies, and long-term software maintenance.
In the final 60-mark TU board examination, examiners heavily emphasize Testing Strategies (White-Box vs Black-Box), Cyclomatic Complexity calculations via control flow graphs, The V-Model, and the 4 types of Software Maintenance.
In this guide, I will break down these core modules with practical exam-oriented diagrams and calculations.
1. Verification vs. Validation (The V-Model)
+-------------------------------+-----------------------------------------------+
| Verification (Are we building | Validation (Are we building the |
| the product right?) | right product?) |
+-------------------------------+-----------------------------------------------+
| * Static analysis without | * Dynamic testing by executing compiled code. |
| executing code. | * Validates software against real-world |
| * Reviews, inspections, | user needs and business SRS requirements. |
| walkthroughs, desk-checking.| * Performed through System, Acceptance, |
| * Performed during design. | and Alpha/Beta testing. |
+-------------------------------+-----------------------------------------------+
The Software Engineering V-Model:
Requirement Analysis ──────────────────────────────► Acceptance Testing
│ ▲
▼ │
System Design ────────────────────────────────► System Testing
│ ▲
▼ │
Architecture Design ──────────────────────► Integration Testing
│ ▲
▼ │
Module / Low-Level Design ────────► Unit Testing
│ ▲
└─────────────► [Coding] ─────────┘
2. Software Testing Methodologies
+-------------------+-----------------------------------+-----------------------------------+
| Parameter | Black-Box Testing (Functional) | White-Box Testing (Structural) |
+-------------------+-----------------------------------+-----------------------------------+
| **Knowledge** | No internal code knowledge needed.| Requires complete source code |
| | Focuses on inputs and outputs. | logic, loops, and branch vision. |
+-------------------+-----------------------------------+-----------------------------------+
| **Techniques** | 1. Boundary Value Analysis (BVA) | 1. Basis Path Testing |
| | 2. Equivalence Class Partitioning | 2. Control Flow Graph (CFG) |
| | 3. Decision Table Testing | 3. Condition / Branch Coverage |
+-------------------+-----------------------------------+-----------------------------------+
| **Tested By** | QA Engineers, End-Users, Clients. | Software Developers / Architects. |
+-------------------+-----------------------------------+-----------------------------------+
3. White-Box Testing: Calculating Cyclomatic Complexity
Cyclomatic Complexity $V(G)$ is a quantitative software metric that measures the number of linearly independent paths through a program’s source code, determining the minimum number of test cases required for 100% path coverage.
Formulas for $V(G)$:
- Formula 1 (Edges & Nodes): $V(G) = E – N + 2P$ (where $E$ = edges, $N$ = nodes, $P$ = connected components, usually $P = 1$)
- Formula 2 (Predicate Nodes): $V(G) = P_{nodes} + 1$ (where $P_{nodes}$ = number of decision points:
if,while,for,case) - Formula 3 (Enclosed Regions): $V(G) = \text{Total Enclosed Regions} + 1$
Solved TU Board Problem: Cyclomatic Complexity & Test Cases
Code Snippet:
int checkStudentEligibility(int age, int gpa) {
if (age >= 18) { // Node 1: Decision
if (gpa >= 3.0) { // Node 2: Decision
return ADMITTED; // Node 3: Statement
} else {
return WAITLISTED; // Node 4: Statement
}
} else {
return REJECTED_AGE; // Node 5: Statement
}
} // Node 6: Exit
Step 1: Count Predicate Decision Points ($P_{nodes}$):
– Decision 1: if (age >= 18)
– Decision 2: if (gpa >= 3.0)
– $P_{nodes} = 2$
Step 2: Calculate $V(G)$:
$$V(G) = P_{nodes} + 1 = 2 + 1 = \mathbf{3}$$
Step 3: Derive the 3 Independent Test Paths:
1. Path 1 (Rejection): age < 18 $\implies$ Path: 1 -> 5 -> 6 (Input: age = 16, gpa = 3.5)
2. Path 2 (Admitted): age >= 18 AND gpa >= 3.0 $\implies$ Path: 1 -> 2 -> 3 -> 6 (Input: age = 20, gpa = 3.8)
3. Path 3 (Waitlisted): age >= 18 AND gpa < 3.0 $\implies$ Path: 1 -> 2 -> 4 -> 6 (Input: age = 22, gpa = 2.5)
4. The 4 Types of Software Maintenance
+---+---------------+-------------------------------------------------------------------+
| # | Type | Description & Real-World Trigger |
+---+---------------+-------------------------------------------------------------------+
| 1 | **Corrective**| Fixing discovered bugs, logic flaws, and runtime crash errors. |
+---+---------------+-------------------------------------------------------------------+
| 2 | **Adaptive** | Updating software to run on new OS versions, databases, or cloud. |
+---+---------------+-------------------------------------------------------------------+
| 3 | **Perfective**| Enhancing performance, refining UI responsiveness, adding features.|
+---+---------------+-------------------------------------------------------------------+
| 4 | **Preventive**| Refactoring legacy code and updating documentation before failure.|
+---+---------------+-------------------------------------------------------------------+
Frequently Asked Questions (FAQ)
Q1: What is the difference between Alpha Testing and Beta Testing?
Alpha Testing is conducted at the developer’s site by internal QA teams in a controlled lab environment. Beta Testing is conducted at end-user locations in real-world production environments without developer supervision.
Q2: What is Regression Testing?
Regression testing is the selective re-execution of previously passed test cases to verify that recent code modifications or bug fixes have not unintentionally broken existing stable features.



