Se 1
Se 1
Unit – VI
Software Testing
This PDF is watermarked and traceable. Unauthorized sharing will result in
permanent access ban and legal action.
Su
1. Software Testing
dh
Software Testing is the process of evaluating a software application to check if it meets the
an
It ensures that the product is reliable, functional, and user-friendly before it is released to
u
customers.
De
1. Understand Requirements Clearly: Testers must fully understand what the software
90
2. Start Testing Early: Begin testing activities during the requirement and design phases
61
3. Plan Testing Properly: Prepare a detailed test plan, covering scope, resources,
64
4. Prioritize Test Cases: Focus first on testing critical and high-risk areas of the
application.
5. Use a Mix of Testing Types: Combine different types like functional, performance,
security, and usability testing for better coverage.
2|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
6. Automate Where Possible: Use automation for repetitive tests to save time and
increase reliability.
8. Track and Manage Defects Well: Log defects clearly and track them through their
entire life cycle.
Su
9. Continuously Review and Improve: Regularly review the testing process, learn from
dh
10. Ensure Good Test Environment Setup: Create a test environment that closely
sh
effective.
A strategic approach to testing means planning how testing activities will be performed,
m
systematically uncovering defects, and ensuring the quality of the software product.
uk
It emphasizes that:
h
-+
• Testing should begin early in the software development life cycle (SDLC).
91
Key Points:
75
1. Early Testing: Testing starts at the requirements phase to catch errors early.
61
2. Systematic Progression: Testing moves from small units (unit testing) ➔ integration ➔
system testing ➔ acceptance testing.
62
64
3. Planned Testing: Test planning is done before coding, with clear objectives and methods.
5. Risk-Based Focus: Focus more on critical, high-risk areas to use time and resources
efficiently.
Verification
Verification is the process of checking whether the software is being built correctly (according
Su
Purpose: To ensure the product is developed properly without any mistakes in the process.
an
Focus: On process and documents (like requirements, design, and code reviews).
sh
Examples:
u
o Reviewing requirements.
De
o Code inspections.
m
Validation
h
Validation is the process of checking whether the software meets the user's needs and works
-+
as expected.
91
Purpose: To ensure the final product is correct and satisfies user requirements.
90
Examples:
61
o Functional testing.
62
Meaning Are we building the product right? Are we building the right product?
4|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Purpose Ensure the software is developed Ensure the software meets user needs
correctly
Organizing for software testing means structuring the testing activities and responsibilities
properly within the project or company. It ensures that testing is well-planned, efficient, and
h
• Developers:
75
• Independent Testers:
64
o They are separate from the development team to ensure unbiased testing.
The Criteria for Completion of Testing (also called Exit Criteria) define when testing
m
activities can be stopped. It ensures that enough testing has been done and the software is
uk
1. Entry Criteria: Entry Criteria define the conditions that must be met before testing can
-+
start. They ensure that the necessary requirements, resources, and readiness are in place for
91
testing.
90
• Test Plan Approved: The overall test strategy and test plans are approved.
61
• Test Environment Set Up: The test environment (hardware, software, networks) is
configured and ready for testing.
62
Test Data Available: The necessary test data for different scenarios is prepared and
64
available.
• Code is Stable: The code has reached a point where it is stable enough for testing. All
critical features must be implemented and ready for testing.
• Test Team Ready: The testing team is properly trained, with resources, tools, and
knowledge required to perform the tests.
6|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
• Requirements are Clear: The requirements and specifications of the software are
well-defined, and test cases are created accordingly.
2. Exit Criteria: Exit Criteria define the conditions that must be met before testing can be
considered complete. They help determine when testing is finished and the software is ready
for release or deployment.
• All Test Cases Executed: All planned test cases have been executed, and their results
dh
are documented.
an
• Defects Resolved: All major defects have been fixed and re-tested. Minor defects are
sh
• Test Coverage Achieved: All requirements (both functional and non-functional) have
De
• Performance Goals Met: The software has met its performance, security, reliability,
and other non-functional goals.
m
uk
• Defect Density Acceptable: The defect density is low enough to meet the quality
standards. Any remaining defects are considered acceptable based on the project's risk
h
tolerance.
-+
with the test results, and the product meets their expectations.
90
• Test Reports Completed: Detailed test reports are completed, showing the results of
75
The Software Testing Life Cycle (STLC) is a series of steps followed during testing to ensure
64
software quality. It defines how testing is planned, executed, and completed in a structured
way.
Phases of STLC
2. Test Planning: The testing strategy is prepared: resources, tools, and timelines are decided.
7|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
3. Test Case Development: Testers write detailed test cases and prepare test data.
4. Environment Setup: A testing environment (like servers, software) is set up, similar to the
real system.
5. Test Execution: Testers run the test cases and report any defects found.
6. Test Closure: After testing is done, results are documented, defects are verified, and the
Su
1. Requirement Analysis: Understand that users must add items to the cart.
u
3. Test Case Development: Write test cases for adding items to the cart.
sh
Advantages of STLC
-+
Disadvantages of STLC
62
The Defect Life Cycle is the process that a defect (bug) follows from the moment it is found
until it is fixed and closed. It describes all the stages a defect passes through in its lifetime.
4. Fixed: The developer fixes the defect and updates its status.
sh
If the button still didn’t work, the tester would reopen the defect.
• Ensures that all defects are handled properly (fixed, deferred, or closed).
Su
• If not managed well, defects may get stuck in certain statuses (like Assigned or Open).
sh
• Adds overhead when small or low-priority defects also go through the entire cycle.
m
uk
Strategic Issues in software testing refer to the important decisions and challenges that shape
-+
how testing will be conducted throughout the project. These issues address both planning and
execution of testing, ensuring that the testing efforts are aligned with business goals, deadlines,
91
1. Test Planning: When to start and what to test based on project priorities and risks.
61
2. Test Coverage: Balancing thorough testing with time/resources. Focus on high-risk areas.
62
3. Test Resources: Ensure the right team size, skills, tools, and infrastructure are in place.
64
4. Test Execution and Automation: Decide manual vs automated testing for efficiency and
accuracy.
5. Defect Management: Prioritize and track defects, ensuring critical issues are addressed
first.
10 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
6. Test Metrics and Reporting: Track key metrics (defect density, coverage) and report
progress to stakeholders.
7. Test Environment and Data: Set up a realistic test environment and manage test data
effectively.
8. Time and Cost Constraints: Balance quality with time/budget limits, making trade-offs
where necessary.
Su
Test strategies for conventional software involve structured approaches to ensure the
an
software meets its requirements, functions correctly, and is free from defects. These strategies
sh
focus on various testing levels, processes, and methodologies to deliver a reliable product.
u
De
sh
m
uk
h
-+
91
90
75
61
62
1. Unit testing - In this type of testing techniques are applied to detect the errors from each
64
3. Validation testing - It provides assurance that the software validation criteria (established
during requirements analysis) meets all functional, behavioral and performance requirements.
11 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
4. System testing - In system testing all system elements forming the system is tested as a
whole.
Unit Testing is the process of testing individual components (like functions, classes, or
modules) of a software system in isolation to ensure that each one works correctly and
independently.
Su
• Purpose: To verify that each small piece of the program performs as designed.
dh
The various tests that are conducted during the unit test are described as below.
u
De
1. Module interfaces are tested for proper information flow in and out of the program.
2. Local data are examined to ensure that integrity is maintained.
sh
3. Boundary conditions are tested to ensure that the module operates properly at
m
4. All the basis (independent) paths are tested for ensuring that all statements in the
module have been executed only once.
h
During unit testing, the following types of errors are typically detected:
2. Incorrect Functionality: Function does not produce the correct output for given inputs.
12 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
3. Boundary Errors: Issues when input values are at their minimum, maximum, or just
outside expected ranges.
When doing unit testing, the module being tested might depend on other modules that are not
yet developed. To simulate these dependencies, drivers and stubs are used:
sh
• Driver:
u
De
• Stub:
h
o Example: A fake database response when the actual database module isn't ready.
90
75
61
62
64
Integration Testing is the process of testing the interaction between two or more individual
software components after they have been unit-tested.
13 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
• Purpose: To ensure that different modules work together properly when combined.
Key Points:
1. Focus: Detect errors in module interactions, such as incorrect data sharing, wrong
function calls, or interface mismatches.
Su
2. Approach: Instead of testing modules individually, now test them combined to check
dh
2. Incremental integration
90
75
61
62
64
1. Non-Incremental Integration
14 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Non-Incremental Integration, also called Big Bang Integration, is a method where all
modules are combined at once after unit testing, and the entire system is tested together.
Key Points:
• Advantages:
dh
• Disadvantages:
u
o Difficult to debug errors because it’s hard to tell which module caused the problem.
De
o High risk — if many errors occur, finding and fixing them becomes time-
sh
consuming.
m
2. Incremental Integration
h
i. Top-down integration
91
Key Points:
• Approach:
Test the top-level module first, then gradually add and test lower-level modules.
• Use of Stubs:
o If a lower module is not yet ready, a stub is used to simulate its behavior.
Su
o Stub temporarily replaces the missing module and returns dummy results.
dh
• Process:
an
Advantages:
sh
Disadvantages:
-+
• Lower-level functionality may not be tested thoroughly until late in the process.
90
Example: In an Online Shopping System, the main module "Shop System" controls login,
75
• Use stubs for "Login Module," "Product Search," and "Payment Module" if they aren't
ready.
64
• Gradually replace stubs with real modules and test their integration.
Bottom-Up Integration Testing is a method where testing starts from the lowest (leaf)
modules and moves upward toward the main module.
16 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Su
dh
an
sh
u
De
Key Points:
sh
• Approach: Begin by testing smallest, independent modules first, then combine them
m
• Use of Drivers: If a higher-level module is not ready, a driver is created to call and test
h
• Process:
91
Example (Short):
62
In a Banking System:
64
• Start by testing small modules like "Balance Checker", "Deposit", and "Withdraw".
• After lower modules are tested, combine and integrate them into the main Banking
System.
Advantages:
17 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Disadvantages:
Regression Testing is the process of retesting the existing software after any changes, bug
sh
fixes, or enhancements to make sure that the new code does not break the existing
u
functionality.
De
Key Points:
sh
• Purpose:
m
To check that the old (unchanged) code still works correctly after updates.
uk
• When to do it:
h
Example: Suppose you fix a bug in the payment module of an online shopping app.
64
In regression testing, you will also test login, cart, search features to make sure they still work
properly.
Advantages:
Disadvantages:
Smoke Testing is a type of preliminary testing performed to check if the basic functions of
Su
Key Points:
an
• Purpose: To quickly assess whether the core features of the system are working. It helps
sh
determine whether the build is stable enough for further, more detailed testing.
u
• When to perform:
De
• Focus: Test the critical and essential features of the software (e.g., login, navigation, basic
uk
workflows).
h
Example: In an e-commerce website, after a new build is deployed, smoke testing checks if:
91
If these core functions fail, further detailed testing is halted until the major issues are fixed.
62
Advantages:
64
Disadvantages:
19 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
System Testing is the process of testing the complete and integrated software system to
ensure that it meets the specified requirements and works as intended in the overall
Su
environment.
dh
Key Points:
an
• Purpose: To verify that the entire system functions correctly and satisfies the user
requirements.
sh
• Scope: It tests the whole system, including interactions between modules and external
u
• Types of Tests:
sh
o Functional Testing: Verifies that the system performs the required functions.
m
uk
When to Perform: After integration testing, once all components of the system have been
-+
integrated.
91
• Testing the entire system including login, account management, transaction processing,
75
and reporting.
61
• Ensuring that the system performs well under load, handles edge cases, and interacts
62
Advantages:
• Ensures the system works as a whole and meets all functional and non-functional
requirements.
Disadvantages:
20 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
1. Recovery testing
2. Security testing
Su
3. Stress testing
4. Performance testing
dh
1. Recovery Testing
an
Recovery Testing is a type of testing that checks the software’s ability to recover from
sh
Key Points:
De
• Purpose: To ensure that the system can recover gracefully from various types of
sh
• How it's done: Simulate failure scenarios (e.g., power loss, system crashes) and verify
uk
Example: In a banking app, recovery testing might simulate a server crash during a
-+
Advantages:
61
Disadvantages:
2. Security Testing
21 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Security Testing is the process of verifying that a software application is protected from
unauthorized access, data breaches, and potential vulnerabilities.
Key Points:
• Purpose: To ensure that the system is secure against attacks and that sensitive data is
kept safe.
Su
• Focus Areas:
dh
o Authorization: Ensure users only access data they are permitted to.
sh
Example: For an online banking system, security testing would check if:
sh
Advantages:
-+
Disadvantages:
75
3. Stress Testing
64
Stress Testing is a type of testing that evaluates how a software application behaves under
extreme conditions or when it is subjected to heavy loads beyond normal operational capacity.
Key Points:
22 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
• Purpose: To determine the system's breaking point and ensure it can handle extreme
situations without crashing.
• Focus Areas:
o Performance under high load (e.g., many users or large data volumes).
o How the system behaves when resources are exhausted (e.g., memory, processing
Su
power).
dh
Example: For an e-commerce website, stress testing might involve simulating thousands of
users trying to access the website simultaneously during a big sale. This checks if the system
an
Advantages:
u
Disadvantages:
m
uk
4. Performance Testing
91
Performance Testing is the process of evaluating how a software application performs in terms
of speed, responsiveness, and stability under various conditions.
90
Key Points:
75
Purpose: To ensure that the system performs efficiently under expected loads and meets
61
performance requirements.
62
• Focus Areas:
64
• Whether the app can handle increasing numbers of players without slowing down.
Advantages:
Disadvantages:
dh
Testing object-oriented (OO) software requires strategies that consider the unique
De
Key Points:
uk
1. Class Testing:
h
o Focus on testing individual classes to ensure their methods and behaviors are correct.
-+
o Unit testing is essential here, where each class is tested independently to check for
91
errors in functionality.
90
2. Integration Testing:
75
behaviors.
64
3. State-based Testing:
o Verify that state transitions are correct according to the class's behavior.
4. Inheritance Testing:
24 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
o Overridden methods and inherited features must be tested for correct functionality.
5. Polymorphism Testing:
o Test how polymorphic behavior works, ensuring that the correct method is called
when objects of different types are used interchangeably.
Su
o Check if objects can handle invalid inputs, errors, or unexpected conditions without
sh
breaking.
u
7. Interaction Testing:
De
o Focus on testing interactions between objects in a system to ensure that data flows
sh
Example: For a banking system, class testing might check the Account class, ensuring
h
methods like deposit() and withdraw() work correctly. Integration testing checks if
-+
Account and Transaction classes interact properly. Inheritance testing ensures that a
SavingsAccount correctly inherits from the Account class and adds its own behavior.
91
Advantages:
90
Disadvantages:
62
challenging.
1. Testing Individual Methods: Each method within a class is tested to ensure it performs
dh
3. State and Behavior: Unit tests verify that objects maintain the correct state and exhibit
De
4. Class Invariants: Unit tests check if the class maintains its invariants (rules that must
always be true for the class) throughout its operation.
m
uk
Example:
h
Advantages:
61
Disadvantages:
In Object-Oriented (OO) systems, integration testing checks how different classes and objects
work together after unit testing. The goal is to detect errors in interactions between classes.
1. Cluster Testing: Groups of related classes (called clusters) are tested together to verify
Su
correct interaction.
dh
2. Interaction Between Objects: Tests are designed to check how objects collaborate,
communicate, and pass data among themselves.
an
3. Incremental Integration: Classes are integrated and tested step-by-step rather than all
sh
4. Use of Drivers and Stubs: Sometimes drivers (temporary calling programs) and stubs
De
As shown in the diagram, Integration Testing is divided into two main approaches:
61
1. Thread-Based Testing
62
• It tests a set of classes that work together to accomplish a specific function (a thread of
64
control).
Example: In an online shopping system, testing how Cart, Payment, and Order classes interact
when placing an order.
27 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
2. Use-Based Testing
• It focuses on testing classes based on usage relationships (how one class uses
another). It is divided further into:
▪ These classes are easy to test as they have minimal external requirements.
dh
▪ Classes that rely on others are tested after the classes they depend on are tested
sh
and stable.
u
Example: Test a Payment class (dependent) after confirming the Wallet class (independent)
De
works correctly.
sh
Advantages:
m
• Improves system reliability: Helps build a more stable and predictable system.
-+
Disadvantages:
91
testing harder.
75
• Requires careful planning: Missing object interactions can lead to hidden bugs later.
61
Unit Testing Tests individual functions or Tests individual classes and methods
Focus procedures separately. along with their internal states.
Data and Focuses separately on data and Focuses on both data and behavior
Behavior functions. (since they are combined inside
objects).
Testing web applications is important because they work over networks, interact with browsers,
and are used by many users at once.
sh
1. Functionality Testing: Ensure all links, forms, buttons, and workflows work correctly.
h
-+
2. Usability Testing: Test if the app is user-friendly, easy to navigate, and visually clear.
91
3. Interface Testing: Verify interactions between web server, application server, and
database server.
90
4. Compatibility Testing
75
tablet, mobile).
62
5. Performance Testing: Test load time, server response time, and behavior under heavy
user traffic.
6. Security Testing: Check for vulnerabilities like SQL injection, cross-site scripting
(XSS), and unauthorized access.
29 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
7. Recovery Testing: Verify the web app can recover from crashes, server failures, or
network issues.
Validation Testing is done to ensure that the final software meets the customer requirements
and works as expected in the real-world environment.
dh
Key Points:
sh
• Purpose: To ensure that the right product has been built according to user needs and
u
business goals.
De
• Focus Areas:
sh
o Correctness: Whether the software provides correct outputs for all inputs.
m
uk
Example:
91
• If the user can successfully browse products, add to cart, and complete payments.
75
If all business rules (like discounts, offers, shipping charges) are applied correctly.
61
Advantages:
62
Disadvantages:
Acceptance Testing is the process of verifying if the complete software system is ready for
delivery by ensuring it meets business requirements and is acceptable to the end user or
client.
Key Points:
Su
• Purpose: To confirm that the system works correctly and is acceptable for release.
dh
• Focus Areas:
an
Example:
sh
• Can users place orders, track deliveries, and make payments easily?
uk
Advantages:
-+
Disadvantages:
75
1. Alpha Testing:
• Conducted in-house by internal staff (developers, testers) before releasing to real users.
Example: Developers testing a photo editing app in the office before it is given to selected
users.
2. Beta Testing:
Example: Releasing a new social media app to a few thousand users before global launch to
dh
testers)
sh
Purpose Find bugs before release to Gather user feedback for improvements
uk
users
h
Timing Before Beta Testing After Alpha Testing, before final release
-+
Feedback Type Technical issues mainly User experience and feature suggestions
90
Validation Test Criteria are the conditions that must be satisfied to ensure that the software
61
correctly implements the customer's requirements and is ready for final acceptance.
62
Key Points:
64
• Purpose: To verify that the software system does what the user expects.
• Focus:
Example: For a flight booking website, validation test criteria would ensure:
an
• Users can search flights, book tickets, and receive confirmations correctly.
sh
Configuration Review is a formal process where the software’s technical and design aspects
m
are carefully examined to ensure that the system is complete, correct, and ready for
uk
validation testing.
h
Key Points:
-+
• Purpose: To verify that all required components (software modules, documents, data
91
• Focus Areas:
75
White Box Testing is a software testing method where the tester has full knowledge of the
internal code, logic, and structure of the application. The focus is on checking how the system
Su
Key Points:
an
• Requires Code Knowledge: Testers must understand the code and how the software is
built.
sh
• Test Case Design: Based on internal structures like functions, conditions, loops, and
u
paths.
De
Advantages:
m
uk
Limitations:
91
return a + b;
64
• Check if the function correctly adds different values like add(2, 3) and add(-1, 5).
• Verify all possible paths (although simple here, larger code would have multiple conditions
and loops to check).
34 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
You are not just looking at the output, but also verifying that the logic and flow inside the
function are correct.
Black Box Testing is a software testing method where the tester checks the system's
functionality without any knowledge of its internal code or structure. The main focus is on what
the system does, not how it does it.
Su
Key Points:
dh
• No Code Knowledge: Testers only work with inputs and expected outputs.
an
• Focus: Tests whether the system behaves correctly for different inputs.
u
De
Advantages:
sh
Limitations:
h
• Expected Output: If the credentials are correct, the user logs in; if incorrect, an error
61
message appears.
62
• Verify whether the system accepts or rejects them correctly, without checking how the
login is implemented inside.
35 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Knowledge Tester must know the internal Tester does not need any
Required code and logic. knowledge of code.
programming skills.
u
Main Goal To verify internal working and To check if the system meets user
De
large systems.
-+
function. inputs.
90
Path Testing is a method that is used to design the test cases. In the path testing method, the
61
control flow graph of a program is designed to find a set of linearly independent paths of
62
execution. In this method, Cyclomatic Complexity is used to determine the number of linearly
independent paths and then test cases are generated for each path.
64
It gives complete branch coverage but achieves that without covering all possible paths of the
control flow graph. McCabe’s Cyclomatic Complexity is used in path testing. It is a structural
testing method that uses the source code of a program to find every possible executable path.
• Control Flow Graph: Draw the corresponding control flow graph of the program in which
sh
• Cyclomatic Complexity: After the generation of the control flow graph, calculate the
De
where,
uk
P = Program factor
-+
• Make Set: Make a set of all the paths according to the control flow graph and calculate
91
cyclomatic complexity. The cardinality of the set is equal to the calculated cyclomatic
90
complexity.
75
• Create Test Cases: Create a test case for each path of the set obtained in the above step.
61
• Control Flow Graph: The program is converted into a control flow graph by
64
• Decision to Decision path: The control flow graph can be broken into various
Decision to Decision paths and then collapsed into individual nodes.
A Control Flow Graph (CFG) is the graphical representation of control flow or computation
during the execution of programs or applications. Control flow graphs are mostly used in static
analysis as well as compiler applications, as they can accurately represent the flow inside a
program unit. The control flow graph was originally developed by Frances E. Allen.
• The control flow graph shows all the paths that can be traversed during a program
an
execution.
sh
• Edges in CFG portray control flow paths and the nodes in CFG portray basic blocks.
De
• Entry Block: The entry block allows the control to enter into the control flow graph.
m
uk
Hence, the control flow graph comprises all the building blocks involved in a flow diagram
-+
such as the start node, end node, and flows between the nodes.
91
Control Flow Graph is represented differently for all statements and loops. The following
images describe it:
75
1. if-else 2. while
61
62
64
38 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
3. do-while 4. for
Su
dh
an
sh
Example:
u
if A = 10 then
De
if B > C
sh
A = B
m
uk
else A = C
h
endif
-+
endif
91
print A, B, C
90
Advantage of CFG
sh
Disadvantages of CFG
90