Lecture 1: Introduction to Software Verification and Validation
Learning Outcomes
By the end of this course, students should be able to:
Understand software verification and validation concepts.
Identify different testing techniques and design test plans.
Develop and evaluate test suites.
Use testing frameworks and tools.
Program Specification
To verify if a function is correct, we need to know what the
program is supposed to do.
Simply analyzing code is not enough:
o Reading code is frustrating and unreliable.
o Understanding what the code does does not guarantee
correctness since we need to compare it against intended
behavior.
Defining Specification
A specification is a separate statement defining expected
program behavior.
It includes written descriptions, charts, figures, and examples
of expected inputs and outputs.
Example: Longest Increasing Subsequence
Given an array A[1…n], the function should return the length
of the longest strictly increasing sequence.
Issues:
o What does "strictly increasing" mean?
o Are we considering the array values or indices?
o What happens if values repeat?
Specification Requirements
Clearly define:
o IN parameters (input variables and types).
o OUT parameters (important outputs after execution).
o Global variables (variables outside the function affecting
execution).
o Preconditions (valid input constraints).
o Postconditions (expected relationships between input
and output).
Verification vs. Validation
Verification: Ensures the program is correct according to its
specification.
Validation: Ensures the specification accurately represents
user needs.
Testing and Debugging
Verification determines if a program meets its specification.
Testing helps find bugs but does not guarantee correctness.
Static Analysis allows detecting issues without execution.
Lecture 2: Software Testing and Test Cases
Types of Software Testing
1. Black-box testing:
o Based on input-output behavior without looking at the
internal structure.
o Includes functional, usability, and performance testing.
2. White-box testing:
o Examines code structure and logic.
o Includes unit, integration, and system testing.
3. Unit Testing:
o Tests individual components (functions, modules).
o Helps detect defects early.
4. Integration Testing:
o Checks interactions between multiple components.
o Ensures smooth communication between modules.
Test Case Design Strategies
1. Equivalence Partitioning:
o Divides input data into valid and invalid partitions.
o Reduces the number of test cases while maximizing
coverage.
2. Boundary Value Analysis:
o Tests values at the edges of valid and invalid ranges.
o Example: If an input range is (1-100), test values at 0, 1,
100, and 101.
Coverage Metrics
1. Statement Coverage: Ensures every statement is executed at
least once.
2. Branch Coverage: Tests all decision points (if-else conditions).
3. Path Coverage: Tests all possible execution paths in the
program.
Fault-based Testing
Introduces faults to analyze how the software behaves.
Helps in designing robust test cases.
Lecture 3: Software Testing Frameworks and Automation
Importance of Automated Testing
Increases efficiency and reduces manual errors.
Allows for rapid testing in continuous development environments.
Common Testing Frameworks
1. JUnit (Java-based) – For unit testing in Java applications.
2. Selenium – Automates web application testing.
3. PyTest – Used for Python testing.
Regression Testing
Ensures new changes do not break existing functionality.
Usually automated to run after each update.
Test-Driven Development (TDD)
Write test cases before writing the actual code.
Ensures code correctness and prevents future bugs.
Continuous Integration (CI) & Testing
Developers commit changes to a shared repository frequently.
Automated testing is performed after each update to detect errors
early.
Lecture 4: Software Validation and Quality Assurance
Validation Techniques
1. Reviews and Inspections:
o Manual process of checking requirements and design for errors.
o Types:
Peer reviews (developer checks another developer’s
work).
Formal inspections (structured meetings for defect
detection).
2. Prototyping:
o Build an early version of the software for user feedback.
o Helps validate user requirements before full development.
Quality Assurance (QA)
Ensures software is reliable, usable, and maintainable.
Involves both testing and process improvement techniques.
Defect Tracking and Management
Uses tools like:
o Jira
o Bugzilla
Helps manage reported issues efficiently.
Software Reliability
Focuses on minimizing failures and ensuring long-term software
stability.
Reliability is measured through MTBF (Mean Time Between
Failures).