Software Engineering · Unit 8 · 5 hrs
Software Testing
Exam-focused notes for Software Testing (Software Engineering, CSC375): what the TU syllabus asks and how it has actually been tested, with 7 solved past questions from this unit.
Software Testing in short
Software testing is the activity of executing a program with the aim of finding defects before the software is put to real use, and of building confidence that it does what it is meant to do.
What this unit covers
- Introduction
- Validation and Verification Testing
- Software Inspection
- Software Testing Process
- Development Testing
- Test-Driven Development
- Release Testing
- User Testing
Validation and Verification Testing
2081 · 5 marks
Difference between verification and validation. Explain software inspection process. [5]
2079 · 5 marks
Differentiate between verification and validation. Explain the software Inspection process. [5]
2077 · 10 marks
Compare between verification and validation. Why validation is particularly difficult process? Explain with example.[10]
2076 · 5 marks
Write Short notes on: a. Reliability validation b. Reverse engineering [5]
Show solved answerHide answer
Short Notes
a. Reliability Validation
Reliability validation is a part of the broader software validation activity in software engineering. Validation is concerned with building the right system -- it is intended to show that a system conforms to its specifications and meets the user's expectations.
Reliability validation specifically focuses on verifying that the software performs its intended functions correctly and consistently over time, under defined conditions, without failure.
Key Points:
-
Purpose: To demonstrate that the software can be trusted by its users. As noted in software engineering principles, the trust challenge requires developing techniques that demonstrate software can be trusted -- reliability validation directly addresses this challenge.
-
Importance in Safety-Critical Systems: In areas such as space, aviation, and nuclear power plants, the cost of software failure can be massive because lives are at risk. Reliability validation is therefore critical in such domains.
-
Cost Consideration: Roughly 60% of software costs are development costs and 40% are testing costs. For real-time and safety-critical software, validation and testing require even more extensive effort than web-based systems.
-
Process: It involves:
- Running the system under realistic conditions
- Measuring failure rates
- Comparing results against reliability requirements specified during software specification
-
Outcome: A validated, reliable software system improves overall software quality, reliability, and productivity -- all recognized advantages of proper software engineering practice.
b. Reverse Engineering
Reverse engineering in software engineering is the process of analyzing an existing software system to identify its components, their relationships, and to extract design and requirement information -- essentially working backwards from the implemented system to recover higher-level abstractions such as design documents or specifications.
Key Points:
-
Definition: It is the process of recovering the design, architecture, or requirements of a software system from its source code, binary, or documentation when the original design artifacts are unavailable or outdated.
-
Why It Is Needed:
- Over time, software evolves to meet changing customer needs. As noted, software evolution is a fundamental software engineering activity, and evolution costs often exceed development costs for customer software.
- Original documentation may be lost, incomplete, or outdated after repeated maintenance cycles.
-
Goals of Reverse Engineering:
- Understand the existing system before making changes
- Recover lost documentation
- Support software re-engineering or migration to a new platform
- Detect security vulnerabilities
-
Process Steps:
- Information extraction -- collecting data from source code or binaries
- Analysis -- understanding the structure and behavior
- Abstraction -- producing higher-level design or requirement models
-
Relation to Software Evolution: Since software must be written and maintained to meet changing needs of customers, reverse engineering is a practical tool used during the evolution phase of the software process.
Note: The reference notes do not cover reverse engineering in explicit detail; the above is supplemented with standard, correct software engineering knowledge consistent with the curriculum context provided.
Release Testing
2080 · 5 marks
What is release testing? Differentiate between release testing and system testing. [5]
User Testing
2077 · 5 marks
Differentiate between Alpha testing and Beta testing. [5]
Development Testing
2076 · 5 marks
Discuss path testing with suitable example. [5]
Show solved answerHide answer
Path Testing
Definition
Path testing is a white-box (structural) testing technique that aims to design test cases such that every possible path through a program's control flow graph (CFG) is executed at least once. The goal is to ensure complete coverage of all independent paths in the program logic, thereby detecting errors in the program structure and logic.
Key Concepts
Control Flow Graph (CFG)
A CFG represents the program as a directed graph where:
- Nodes represent processing steps (statements or blocks)
- Edges represent flow of control between steps
- Decision nodes represent branching (if, while, for)
Cyclomatic Complexity
Cyclomatic complexity (V(G)) determines the number of independent paths to be tested:
$$V(G) = E - N + 2P$$
Where:
- E = Number of edges
- N = Number of nodes
- P = Number of connected components (usually 1)
Steps in Path Testing
- Draw the Control Flow Graph from the program
- Calculate Cyclomatic Complexity V(G)
- Identify all independent (basis) paths
- Design test cases for each path
- Execute tests and verify results
Example
Program: Find the largest of two numbers
1. Start
2. Read A, B
3. If A > B then
4. Print "A is largest"
5. Else
6. Print "B is largest"
7. End
Step 1: Draw the Control Flow Graph
[1] Start
|
[2] Read A, B
|
[3] A > B ?
/ \
Yes No
| |
[4] Print A [5] Print B
\ /
\ /
[6] End
Step 2: Calculate Cyclomatic Complexity
| Parameter | Value |
|---|---|
| Edges (E) | 6 |
| Nodes (N) | 6 |
| P | 1 |
$$V(G) = E - N + 2P = 6 - 6 + 2(1) = \mathbf{2}$$
So there are 2 independent paths to test.
Step 3: Identify Independent Paths
| Path | Route | Condition |
|---|---|---|
| Path 1 | 1 -> 2 -> 3 -> 4 -> 6 | A > B (True) |
| Path 2 | 1 -> 2 -> 3 -> 5 -> 6 | A > B (False) |
Step 4: Design Test Cases
| Test Case | Input | Expected Output | Path Covered |
|---|---|---|---|
| TC1 | A = 10, B = 5 | "A is largest" | Path 1 |
| TC2 | A = 3, B = 8 | "B is largest" | Path 2 |
Advantages of Path Testing
- Ensures complete logical coverage of the program
- Helps detect unreachable code and dead code
- Identifies logic errors that may not be found by black-box testing
- Provides a measurable coverage criterion using cyclomatic complexity
Disadvantages
- Becomes complex and impractical for large programs with many paths
- Does not test data-related errors (e.g., wrong formula)
- Number of paths can grow exponentially with nested loops and conditions
Summary
Path testing is a systematic white-box technique that guarantees all independent execution paths are tested at least once. By using cyclomatic complexity as a guide, testers can determine the minimum number of test cases required to achieve full path coverage, making it a powerful method for ensuring program correctness.
Make Unit 8 stick
Practice CSC375 with flashcards & quizzes