Module 5-Notes
Module 5-Notes
Software testing:
Software testing is the process of evaluating a software application to ensure that it works as intended, is
free of defects, and meets user requirements.
Testing checks “Does the software do what it is supposed to do?” and “Does it do it correctly?”
Why we do testing?
Types of Testing:
Based on Functionality:
Black Box Testing – Focuses on input-output behavior. Tester doesn’t know the internal code.
White Box Testing – Focuses on internal logic & code structure. Tester knows how the system
works inside.
Grey Box Testing – Combination of both.
Based on Execution:
Other Classifications:
Unit testing is a fundamental software testing practice that focuses on verifying the functionality of
individual components or units of code, such as functions, methods, or classes.
It is typically performed during the early stages of the software development lifecycle to ensure that each unit
works as intended before integration with other components.
In these multiple tests are written for a single function to cover different possible scenarios and these are
called test cases. While it is ideal to cover all expected behaviors, it is not always necessary to test every
scenario.
Unit Testing is a software testing method where individual units or modules of code (like functions,
methods, or classes) are tested in isolation to ensure they work as expected.
To verify that each small piece of the program performs correctly before integrating it with others.
Unit Testing is about verifying that each small part of your software works independently and correctly. It
improves code quality, makes debugging easier, and builds confidence in refactoring and scaling software.
In unit testing tester knows the internal design of the software.Unit testing is white box testing.
Integration Testing :
It mainly tests interface between two software units or modules. It focuses on determining the correctness
of the interface. Once all the modules have been unit-tested, integration testing is performed.
Integration testing is important because it verifies that individual software modules or components work
together correctly as a whole system
Integration testing doesn’t know the internal design of the software. Integration testing is black box testing.
Integration testing is performed after unit testing and before system testing.
Integration testing is performed by the tester.
In simple words, all the modules of the system are simply put together and tested. This approach is
practicable only for very small systems
If an error is found during the integration testing, it is very difficult to localize the error as the error
may potentially belong to any of the modules being integrated.
The goal of big-bang integration testing is to verify the overall functionality of the system and to identify
any integration problems that arise when the components are combined.
Modules:
In Big Bang testing, instead of integrating and testing step by step (like Top-Down or Bottom-Up), all four
modules are combined together in one go, and the system is tested end-to-end.
Modules:
First, high-level modules are tested and then low-level modules and finally integrating the high-level
modules to a low level to ensure the system is working as intended.
Stubs are used as temporary replacements for the lower-level modules until they are developed.
Start with Checkout (top-level) – Test checkout flow using stub for Order Processing, Inventory,
and Cart.
Integrate Checkout + Order Processing – Replace stub of Order Processing with the real module.
Then add Inventory + Cart modules – Integrate step by step, replacing stubs with actual code.
Stub
Driver
Eg.
Validation Testing
Validation testing ensures that the developed software meets the customer’s actual requirements
(the right product is built).
Here we validate or check Are we building the right product?‖
It is requirement-based testing, usually performed after verification activities.
Even if the software is coded correctly (verification), it may still fail customer needs.
Example: You built a payroll system that calculates salary correctly, but the client wanted a tax
calculator as well → system is ―correct‖ but not valid.
Validation testing is about user needs, not just correctness.
Ensures software does what customer expects.
Usually involves system + acceptance testing.
1. Reviews
Definition: A broad term for any type of evaluation of documents or code by one or more people.
Purpose: Detect defects, improve quality, ensure compliance with standards.
Types of Reviews:
2. Walkthroughs
Definition: A type of review(Informal meeting) where the author leads the team through the work
product.
Purpose: To explain the logic, design, or code to others and gather feedback.
Characteristics:
Example: A programmer walks the team through a new algorithm to ensure everyone understands it.
3. Inspections
Definition: The most formal type of review, with a well-defined process, roles, and checklists.
Purpose: To find defects systematically before testing begins.
Characteristics:
Example: A formal inspection of a requirement specification document to catch ambiguities before design
starts.
1. Functional Testing
2. System Testing
3. Acceptance Testing
System testing:
System Testing is a type of software testing that is performed on a completely integrated system to
evaluate the compliance of the system with the corresponding requirements.
Purpose
Example (CMS)
System test: Create a project, assign resources, upload contract documents, run budget reports, close
project — workflow end-to-end.
Non-functional: Simulate 100 concurrent users creating/viewing projects (JMeter).
Run an end-to-end scenario and show result.
Run a performance test and display response-time graphs.
Focuses on:
Inputs → Processing → Outputs
Validating system behavior as per requirements/specifications.
Common techniques:
1. Graph-Based Testing
2. Equivalence Partitioning
3. Boundary Value Analysis (BVA)
1.Graph-Based Testing
Idea: Model software as a graph of nodes (states/modules) and edges (transitions/relationships).
Ensures all links, relationships, and flows are tested.
We imagine the software as a graph.
Nodes = screens/modules.
Edges = transitions (links, relationships, or flows between modules).
Testing is done by traversing all possible paths.
Ensures that workflow/navigation works correctly
Steps
Graph representation:
Test Cases:
TC Test Scenario /
Precondition Steps to Execute Expected Result
ID Path
1. Open CMS.2. Enter valid login
GB- Login → User successfully lands on
CMS running credentials.3. Click Login.4.
01 Dashboard Project Dashboard.
System redirects to Dashboard.
GB- Dashboard → User logged in 1. From Dashboard, select Task Task is assigned
02 Task Assignment and on Assignment.2. Assign a task to a successfully.
TC Test Scenario /
Precondition Steps to Execute Expected Result
ID Path
Dashboard contractor.3. Click Save.
1. From Task Assignment, select
GB- Task Assignment Progress Report is
Task exists Generate Report.2. System should
03 → Report generated correctly.
display task progress report.
1. Open CMS.2. Enter valid
Login → Task System should block access
GB- credentials.3. Try to directly access
Assignment CMS running and show an error (not
04 Task Assignment URL (bypassing
(Invalid Path) allowed/access denied).
Dashboard).
2.Equivalence Partitioning
Idea: Divide input data into equivalence classes (valid & invalid), test only one value from each
class.
Reduces number of test cases while keeping coverage high.
Test Cases:
Input
TC ID Test Scenario Precondition Steps to Execute Value Expected Result
(Days)
1. Navigate to Task
Application is System should accept
Valid input Creation page.2. Enter task
TC_EP_01 running, user 30 the task duration
(within range) duration as 30.3. Click
logged in (Valid Input).
Save/Submit.
1. Navigate to Task System should reject
Invalid input Application is
Creation page.2. Enter task the input and display
TC_EP_02 (below running, user 0
duration as 0.3. Click error message (Invalid
minimum) logged in
Save/Submit. Input).
1. Navigate to Task System should reject
Invalid input Application is
Creation page.2. Enter task the input and display
TC_EP_03 (above running, user 500
duration as 500.3. Click error message (Invalid
maximum) logged in
Save/Submit. Input).
3.Boundary Value Analysis (BVA)
Idea: Errors are often found at the boundaries of input ranges.
Test values just below, at, and just above the boundary.
BVA focuses on edges of input range. Most defects occur just inside or outside valid limits.
Test Cases:
Input
Value
TC ID Test Scenario Precondition Steps to Execute Expected Result
(Budget
in INR)
1. Navigate to
Just below CMS application is Budget Entry page.2. System should reject
TC_BVA_01 minimum running, user is Enter budget amount 9,999 (Invalid Input, show
boundary logged in as 9,999.3. Click error message).
Save/Submit.
1. Navigate to
CMS application is Budget Entry page.2. System should accept
At minimum
TC_BVA_02 running, user is Enter budget amount 10,000 (Valid Input, saved
boundary
logged in as 10,000.3. Click successfully).
Save/Submit.
1. Navigate to
Just above CMS application is Budget Entry page.2. System should accept
TC_BVA_03 minimum running, user is Enter budget amount 10,001 (Valid Input, saved
boundary logged in as 10,001.3. Click successfully).
Save/Submit.
1. Navigate to
Just below CMS application is Budget Entry page.2. System should accept
TC_BVA_04 maximum running, user is Enter budget amount 999,999 (Valid Input, saved
boundary logged in as 999,999.3. Click successfully).
Save/Submit.
At maximum CMS application is 1. Navigate to System should accept
TC_BVA_05 1,000,000
boundary running, user is Budget Entry page.2. (Valid Input, saved
Input
Value
TC ID Test Scenario Precondition Steps to Execute Expected Result
(Budget
in INR)
logged in Enter budget amount successfully).
as 1,000,000.3. Click
Save/Submit.
1. Navigate to
Just above CMS application is Budget Entry page.2. System should reject
TC_BVA_06 maximum running, user is Enter budget amount 1,000,001 (Invalid Input, show
boundary logged in as 1,000,001.3. Click error message).
Save/Submit.
The tester has access to the source code and uses this knowledge to design test cases that
can verify the correctness of the software at the code level.
White box testing is also known as Structural Testing or Code-based Testing, and it is
used to test the software’s internal logic, flow, and structure.
The tester creates test cases to examine the code paths and logic flows to ensure they
meet the specified requirements.
Unlike black-box testing, which focuses on user interactions without knowledge of the
underlying code, white-box testing involves examining the software's source code directly.
Methods of White Box Testing
Basis Path Testing is a white-box testing technique that uses the program’s control flow graph to identify
independent execution paths. It ensures that all logical paths in a program are executed at least once.
Steps
Advantages
Eg
In CFG:
Cyclomatic Complexity is a software metric used in White-Box Testing to measure the logical complexity
of a program.
Method 1:
CC= 11-10+2 = 3
Method 2:
Method 3:
Path 1 : 1 → 2 → 3 → 4 → 5 → 6→ 9→ 11
Path 2: 1 → 2 → 3 → 4 → 5 → 7→ 9→ 11
Path 3 : 1 → 2 → 3 → 4 → 8 → 10→ 11
Definition:
Control Structure Testing is a white-box testing technique that focuses on testing the logical structures,
decisions, and flow of control in a program.
The goal is to ensure that all possible paths, conditions, and variable uses are exercised during testing.
CST is especially useful for programs with decision statements, loops, and nested conditions.
Definition:
Eg : Nested Ifs
Definition:
Focuses on variables: where they are defined (assigned), used, and killed (no longer used).
Ensure every variable is defined before use.
Ensure all definitions reach a use.
Detects issues like undefined or unused variables.
Steps in Data Flow Testing:
Input (projectCost,
Test Scenario Variable Def-Use Pair Tested Expected Output
approvalFromManager)
"Project Auto
Low-Cost Project →
200000, True projectCost: defined → used Approved - Low
Auto Approved
Cost"
High-Cost Project projectCost &
"Project Approved
→ Manager 600000, True approvalFromManager: defined
by Manager"
Approved → used
High-Cost Project projectCost & "Project Rejected -
→ Manager Not 600000, False approvalFromManager: defined No Manager
Approved → used Approval"
Loop Testing
Tests FOR, WHILE, DO-WHILE loops in a program.
Ensures loops execute correctly for minimum, typical, and maximum iterations.
Types :
Simple Loop
Definition:
Nested Loop
Definition:
Definition:
Definition:
A loop that does not have a simple structure (e.g., loops with break, exit, or complex conditions)
Often seen in while loops with multiple exit points.
Software Maintenance:
Even after a software product is delivered to the customer, it cannot remain unchanged. Over time,
software must be modified due to:
1. Bug Fixing
2. Changing Environment
Users often request new features or enhancements once they start using the software.
Example: adding a ―dark mode‖ option to an application.
4. Performance Improvements
Old code, outdated libraries, or poor documentation can lead to future problems.
Example: refactoring code to prevent system crashes.
Definition:
Performed to fix defects or errors found in the software after it has been delivered.
These errors may be in logic, design, or coding that were not detected during testing.
Objective:
Example:
2.Adaptive Maintenance
Definition:
Performed when the environment of the software changes, requiring the software to adapt.
The environment can include operating systems, hardware, business rules, regulations, or
external APIs.
Objective:
Example:
Definition:
Objective:
Example:
Definition:
Objective:
Example:
Goals :
If the system is small and the architecture is fundamentally wrong, a rewrite could be better. Re-engineer
when preserving behavior + reducing risk is the priority.
Re-engineering activities
Recover design, architecture, behavior and requirements from code, binaries, logs.
Produce models: architecture map, component diagrams, data model, use cases.
2. Restructuring / Refactoring
Clean and reorganize code without changing external behavior: rename, modularize,
remove dead code, improve naming.
Add tests to lock behavior.
Purpose
1.Learning Level (Understanding the System)
Used to study and understand how a system works, especially when documentation is missing.
Helps developers, students, or new team members to quickly grasp architecture and logic.
Students analyze the upload module to understand how notes are stored in the database and linked to
subjects.
By understanding existing code, new enhancements and functionalities can be added without
breaking old features.
After analyzing the search function, a new filter by subject and semester feature is added.
Helps students quickly find the right notes.
Reverse engineering is used to create compatible systems or modules that work with existing products but
at a lower cost.
A lightweight mobile app is developed as a cheaper alternative to the full web version, but still
compatible with the same database.
Levels :
1.Abstraction Level
You analyze the program at a high level, without looking at every detail of the source code.
Understand overall structure, architecture, or design.
Info Available : Only abstracted info — modules, interfaces, or high-level workflow
Example:
Understanding that the program has a login module, a file upload module, and a download module,
without seeing the actual code.
Good for creating system diagrams or high-level documentation
2.Completeness Level
You analyze the program with full access to the source code or detailed implementation.
Understand all internal details of the program.
Info Available: All source code, logic, variables, loops, and functions.
Example:
o Inspecting the login module code to see exactly how the password is checked.
o Detecting hidden logic, bugs, or vulnerabilities.
3.Directionality Level
Tracking how uploaded notes move from the client to the server.
Checking if certain conditions can bypass security checks.