8 Software Testing

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.

Software Testing: notes

Introduction

Software testing is intended to show that a program does what it is meant to do, and to discover defects in it before it is put into use; a tester executes the program with carefully chosen data and checks the results of that run for errors, anomalies or evidence about the program's non-functional attributes. The two goals of program testing are, to the developer and customer, to demonstrate that the software meets its requirements, and, to the tester, to discover situations in which the software's behaviour is actually incorrect.

Validation and Verification Testing

Verification asks "are we building the system right?": it checks that the software conforms to its specification, largely through manual activities such as reviews, meetings and inspections, carried out by a QA team without executing the code. Validation asks "are we building the right system?": it checks that the software does what the user genuinely requires, largely through executing the code via black-box and white-box testing, carried out by a testing team. Verification and validation together (V&V) are independent procedures used side by side to confirm that a product meets its requirement specification and fulfils its intended purpose.

VerificationValidation
Evaluates a development-phase product against its requirement and design specification.Evaluates the finished software against customer expectations and requirements.
Carried out through review, meetings and inspection.Carried out through black-box and white-box testing.
Performed by the QA team.Performed by the testing team.
Does not involve executing the code.Involves executing the code.
Manual checking of documents such as the requirements or design specification.Checking of the built software by running it.
"Are we building the system right?""Are we building the right system?"

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]

--- Aspect Verification Validation --------- Definition Checking whether the system is built correctly (process-oriented) Checking whether the right system is built (product-oriented) Focus Confirms the system conforms to its specifications Confirms the system meets user expectations Question Ask...

Open this answer on its own page →

2079 · 5 marks

Differentiate between verification and validation. Explain the software Inspection process. [5]

--- Basis Verification Validation --------- Definition Concerned with building the system right Concerned with building the right system Focus Checks whether the software conforms to its specifications Checks whether the software meets user expectations and needs Question Asked "Are we building t...

Open this answer on its own page →

2077 · 10 marks

Compare between verification and validation. Why validation is particularly difficult process? Explain with example.[10]

Verification is the process of checking whether the software system correctly implements the specifications. It asks the question: "Are we building the product right?" It ensures that the software conforms to its design documents, requirements specifications, and standards at each stage of develo...

Open this answer on its own page →

2076 · 5 marks

Write Short notes on: a. Reliability validation b. Reverse engineering [5]

Show solved 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:

    1. Information extraction -- collecting data from source code or binaries
    2. Analysis -- understanding the structure and behavior
    3. 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.

Open this answer on its own page →

Release Testing

2080 · 5 marks

What is release testing? Differentiate between release testing and system testing. [5]

Release testing is a type of system testing in which a specific release of a system that is intended for use outside the development team is tested. The primary goal of release testing is to convince the supplier of the system that it is good enough for use, i.e., to validate that the system deli...

Open this answer on its own page →

User Testing

2077 · 5 marks

Differentiate between Alpha testing and Beta testing. [5]

Alpha Testing is a type of testing performed to identify bugs before releasing the product to real users. It is typically conducted by QA (Quality Assurance) people or internal testers within the development organization. Beta Testing is a type of testing in which a version of the software is rel...

Open this answer on its own page →

Development Testing

2076 · 5 marks

Discuss path testing with suitable example. [5]

Show solved 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

  1. Draw the Control Flow Graph from the program
  2. Calculate Cyclomatic Complexity V(G)
  3. Identify all independent (basis) paths
  4. Design test cases for each path
  5. 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

ParameterValue
Edges (E)6
Nodes (N)6
P1

$$V(G) = E - N + 2P = 6 - 6 + 2(1) = \mathbf{2}$$

So there are 2 independent paths to test.

Step 3: Identify Independent Paths

PathRouteCondition
Path 11 -> 2 -> 3 -> 4 -> 6A > B (True)
Path 21 -> 2 -> 3 -> 5 -> 6A > B (False)

Step 4: Design Test Cases

Test CaseInputExpected OutputPath Covered
TC1A = 10, B = 5"A is largest"Path 1
TC2A = 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.

Open this answer on its own page →