0% found this document useful (0 votes)
7 views106 pages

Unit-IV(Testing)

The document provides an overview of software testing, detailing its importance, strategies, methods, and types. It explains key concepts such as errors, defects, and failures, and distinguishes between manual and automation testing. Additionally, it covers various testing approaches including white box, black box, and gray box testing, along with their respective techniques and benefits.

Uploaded by

23ag1a05i3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views106 pages

Unit-IV(Testing)

The document provides an overview of software testing, detailing its importance, strategies, methods, and types. It explains key concepts such as errors, defects, and failures, and distinguishes between manual and automation testing. Additionally, it covers various testing approaches including white box, black box, and gray box testing, along with their respective techniques and benefits.

Uploaded by

23ag1a05i3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 106

UNIT-IV

Software Testing
By
Mr.B.Narsimha Reddy
MTech(CSE),(PhD)
Associate Professor
Dept of CSE
What is Testing

• Testing is the process of checking how effective something is.


• It involves finding and fixing errors to ensure the quality standards.
• 1. Testing Strategies
• 2. Metrics for Process and Products
Testing Strategies

• A strategic approach to software testing.


• Test strategies for conventional software.
• Black box and White box testing.
• Validation testing
• System testing
• The art of debugging.
• To understand the basics of software testing, the below terminologies
are to be understood.
• Error
• Defect
• Failure
• Error:
• The error is a human mistake. The errors can be committed by anyone in the
IT team during the different phases of software development.
• Defect:
• A defect is a result of the error. The defect is also termed as a fault.
Sometimes defect is a synonym of bug.
• Failure:
• A failure is a consequence of defect. The software is said to be a failure
when it fails to perform in the real environment. The failure is also caused
due to faults in the hardware system.
• The errors lead to defects and defects lead to failure
of the software.
What is Software Testing?

• Software Testing is a process of verifying and validating whether the


Software Product or Application is working as expected or not.
• The complete testing includes identifying errors and bugs that cause
future problems for the performance of an application.
• For example :
• testing a banking app involves verifying basic functionalities like login,
fund transfer, and account management, as well as non-functional
aspects such as performance during peak usage hours.
Testing Methods
• Static Testing
• Dynamic Testing
Static Testing

• It is also known as Verification in Software Testing.

• Verification is a static method of checking documents and files.

• Verification is the process, to ensure that whether we are building the


product right i.e., to verify the requirements which we have and to
verify whether we are developing the product accordingly or not.
• It's like asking, "Are we building the product the right way?"
• Activities involved here are Inspections, Reviews, Walkthroughs
Dynamic Testing

• It is also known as Validation in Software Testing.

• Validation is a dynamic process of testing the real product.

• Validation is the process, whether we are building the right product


i.e., to validate the product which we have developed is right or not.
• It's like asking, "Are we building the right product?"
• Activities involved in this is Testing the software application (Desktop
application, Web application, Mobile Apps)
Why is Software Testing
Important?
• Software testing is important because it ensures the quality,
reliability, and performance of software before it is released to users.
• Here are the main reasons why software testing is crucial:
1. Identifies and Fixes Bugs Early
• Detecting and fixing errors during development is much cheaper and
less time-consuming than after deployment.
• It helps avoid major failures in production.
2. Ensures Product Quality
• Testing ensures the software meets the specified requirements and
performs expected tasks accurately.
• It validates both functional and non-functional aspects like
performance, usability, and security.
3. Improves User Satisfaction
• A well-tested product delivers a better user experience, reducing the
chance of complaints and negative feedback.
• It builds trust and reliability among users.
4. Enhances Security
• Software testing helps identify security vulnerabilities and threats like
data breaches or unauthorized access.
• Especially important in applications handling sensitive information
(e.g., banking, healthcare).
5. Reduces Maintenance Costs
• Fewer bugs in the released product mean fewer patches and updates
required post-deployment.
• Reduces long-term costs associated with maintenance and customer
support.
6. Supports Continuous Improvement
• Testing helps track software performance across versions, supporting
agile development and continuous delivery.
• Enables regression testing to ensure new features don’t break existing
functionality.
7. Meets Regulatory and Compliance Requirements
• In domains like healthcare, finance, and aerospace, testing is required
to meet legal and regulatory standards.
• Ensures the software is compliant with industry norms and
certifications.
Different types of Software
Testing
Manual Testing
Aspect Description
Testing the software manually without using any automated tools. Testers execute test
Definition
cases by hand.
Execution Speed Slower; takes more time as it requires human involvement.
Accuracy Prone to human errors.
Initial Cost Low – does not require expensive tools or scripting knowledge.

Long-term Cost High – time-consuming and resource-intensive for repeated testing.

Best For Exploratory testing, usability testing, and short-term projects.

Skills Required Basic knowledge of software testing. No programming skills required.

Repeatability Poor – manual tests must be redone every time manually.


Flexibility Highly flexible for unplanned and ad hoc testing.
Automation Testing
Aspect Description
Definition Testing using automation tools and scripts to execute test cases.

Execution Speed Much faster – suitable for running thousands of tests quickly.
Accuracy High – eliminates human errors during execution.
Initial Cost High – requires tools, frameworks, and skilled personnel.
Long-term Cost Lower – saves time and effort on repetitive test cases.
Best For Regression testing, load testing, and large-scale or long-term projects.
Skills Required Requires knowledge of scripting and automation tools.
Repeatability Excellent – tests can be rerun automatically any number of times.

Flexibility Less flexible for last-minute changes or UI-heavy testing.

Test Coverage Broad – allows wide coverage of complex test scenarios.


Summary

Criteria Manual Testing Automation Testing


Speed Slow Fast
Cost Low initially High initially
Accuracy Prone to errors More accurate
Maintenance Easy Requires effort
Best for Exploratory, UI, short-term Regression, performance, large-scale
Types of Software Testing Approaches
(OR)
Types of Manual Testing
White Box Testing
• Definition:
• White Box Testing involves testing the internal structure, design, and
coding of the software.
• The tester needs to understand the internal logic of the code.
Also Known As:
• Clear box testing
• Glass box testing
• Structural testing
Code Coverage Testing
• Code Coverage is a metric used in Software Testing that quantifies the
extent to which the source code of a program is tested.
• It measures the percentage of code executed by the test suite,
helping developers identify untested parts of an application.
• The formula to calculate code coverage is

• Code Coverage = (Number of lines of code executed)/(Total Number


of lines of code in a system component) * 100
White Box Testing coverage techniques in Software Testing

• Statement Coverage
• Branch Coverage
• Path Coverage
• Loop Testing
• Condition Coverage
Statement Coverage

• Definition: Ensures that each line of code (statement) is executed at least once.
• Goal: To verify that all code statements are covered.

• Statement Coverage = (Number of statements executed)/(Total


Number of statements)*100.
Branch Coverage (Decision Coverage)
Definition: Ensures that every
possible branch (true/false) from a
decision point is executed at least
once.
Purpose: Detects issues in control
structures like if, switch, while.

Decision Coverage = (Number of branches executed)/(Total number of decision )*100.


Path Coverage
• Definition:
• Ensures that all possible execution
paths through the code are
tested.
• Purpose: Provides a
comprehensive test but can be
complex due to the number of
paths.
• Example: If there are two if
statements, there are 4 possible
paths (TT, TF, FT, FF).
Loop Testing

• Definition: Focuses on validating loops


(for, while, do-while).
• Goal: To test loop execution under:
• Zero iterations
• One iteration
• Multiple iterations
• Max/min boundary iterations
• Example:
• Testing a loop like
• for (i = 0; i < n; i++) for n = 0, 1, and >1.
Condition Coverage

• Definition: Ensures that each boolean sub-expression (condition) in a


decision is evaluated to both true and false.
• Goal: More fine-grained than branch coverage
• In if (a > b && x > y), condition coverage requires:
• a > b is true and false
• x > y is true and false

• Even if the overall decision outcome doesn't change.

Condition Coverage =(Number of executed operands)/(Total Number of Operands)*100.


Advantages:
• Efficient in finding hidden errors.
• Optimizes code (e.g., removing unnecessary lines).
• Helps ensure all paths in code are tested.
Disadvantages:
• Time-consuming.
• Not useful for large and complex systems without automation.
Black Box Testing
Definition:
Black Box Testing involves testing the software's functionality without
knowing the internal code or structure.

Also Known As:


• Behavioral testing
• Specification-based testing
Key Features:
• Tester does not require programming knowledge.
• Focuses on inputs and expected outputs.
• Based on requirements and specifications.
Techniques of Black Box Testing
Equivalence Partitioning (EP)

• Definition: Divides input data into valid and invalid partitions (also called
classes) that are treated the same by the system.
• Goal: To reduce the number of test cases by testing one value from each
partition.
• Example: For an input field accepting ages 18–56:
• Valid partition: 18–56
• Invalid partitions: below 18, above 56
• Test cases: 25 (valid), 15 (invalid), 65 (invalid)
Boundary Value Analysis (BVA)

• Definition: Focuses on values at the edge (boundaries) of equivalence


partitions.
• Goal: Errors often occur at the boundary, so test cases are derived
from just below, at, and just above the boundary values.
• Example: For age 18–56:
• Test values: 17, 18, 19 and 55,56,57
Decision Table Testing

• Definition: Uses a table to represent combinations of conditions


(inputs) and their corresponding actions (outputs).
• Goal: Ensure coverage for all possible input combinations and their
expected outcomes.
• Example: For a login form:
• Conditions: Username correct? Password correct?
• Actions: Login success/failure
• .
State Transition Testing

• Definition: Tests how the system transitions from one state to


another based on events or inputs.
• Goal: Validate system behavior based on state changes.
• Used When: System has finite states and changes depend on
previous inputs.
• Example: ATM:
• States: Card Inserted → PIN Verified → Transaction
• Transitions: Insert card → Enter PIN → Select transaction
Use Case Testing

• Definition: Tests the user interactions with the system using use
cases (scenarios).
• Goal: Validate end-to-end workflows from the user's point of view.
• Used In: Functional testing based on user stories or requirements.
• Example: A use case for online shopping might involve:
• Browse items → Add to cart → Checkout → Payment → Confirmation
Error Guessing
• Common mistakes that developers usually forget are :

• Handling null values in text fields.


• File upload without attachment.
• Divide by zero.
• File upload is not within the fixed dimensions.
Comparison Testing

• In this testing, different versions of the same software are compared


for testing.
Advantages:
• Useful for large systems.
• Tests from the user's point of view.
• Identifies missing functionalities.
Disadvantages:
• Limited coverage.
• Cannot detect internal bugs or inefficiencies in the code.
• Selenium
• Appium
• Cypress
• LoadRunner
• SoapUI
• JMeter
Gray Box Testing
Definition:
The term “Gray Box Testing” refers to a testing technique that combines
aspects of both white-box and black-box testing.
• It is also sometimes called “Transparent Box Testing.”
Key Features:
• Tester has limited knowledge of the internal workings.
• Focuses on integration and end-to-end testing.
• Useful for identifying security flaws and data handling issues.
Why the Grey Box Testing?
• Grey Box Testing is carried out for the following reasons:

• It combines the advantages of both black box and white box testing
• It combines developer and tester input and improves overall product
quality
• It reduces the overhead associated with the lengthy process of testing
functional and non-functional types
• It provides enough time for a developer to fix bugs
• Testing is conducted from the perspective of the user rather than the
designer
Gray Box Testing Techniques
Matrix Testing

Definition:
Matrix testing involves analyzing the
relationships between different
components, modules, or variables of a
program.
It checks how data and control flow
between them.
Purpose:
• To identify weak spots in the code based
on variable usage and function
dependencies.
• To prioritize tests based on complexity
and interaction.
Regression Testing

Definition:
Regression testing is the process of
re-testing the software after
changes (like bug fixes or new
features) to ensure that existing
functionalities still work correctly.
Purpose:
• To detect new bugs in previously
tested code.
• To ensure stability after code
modifications.
Pattern Testing

Definition:
Pattern testing involves using known patterns (architectural, design,
or behavior patterns) to validate whether the system behaves as
expected.
Purpose:
• To detect anomalies or deviations from standard patterns.
• To test common user interaction or code design scenarios.
Orthogonal Array Testing (OAT)

Definition:
• Orthogonal Array Testing is a statistical method of testing used to
identify the most efficient test combinations.
• It is a combinatorial technique that ensures maximum coverage with
minimal test cases.
Purpose:
• To test all possible combinations of input parameters in a reduced
number of test cases.
• To increase test coverage without exhaustive testing.
Summary

Technique Main Focus Key Benefit


Data/control flow between Identifies complex
Matrix Testing modules interactions
Prevents reintroduction of
Regression Testing Stability after changes old bugs
Conformance to known Detects deviations from
Pattern Testing patterns expected design
Input combinations Reduces test cases,
Orthogonal Array Testing optimization maximizes coverage
Pros:
• Balanced approach between code and behavior.
• More effective in identifying environment/configuration issues.

Cons:
• May not be as thorough as pure white box testing.
• Still requires some access to internal documentation.
Tools for Gray Box Testing
Comparison Table
Feature White Box Testing Black Box Testing Gray Box Testing
Internal Knowledge Full None Partial
Focus Code structure Functionality Integration and behavior
No programming Moderate (technical +
Tester Skill Required Programming skills required functional)
Integration/System
Use Cases Unit/Integration testing System/User acceptance
testing
Logic, performance Missing/incomplete
Detects errors features Security, data flow issues

Session management
Examples Code coverage testing Login form validation
validation
Types of Black Box Testing
• Functionality Testing
• Non-functionality Testing
• Maintenance Testing
Levels of Software Testing
• Software Testing is an important
part of the Software
Development Life Cycle which is
help to verify the product is
working as expected or not.
Unit Testing

• Unit Testing is the first step in testing your software. It focuses on checking individual
components or functions of the application to make sure they work correctly on their own.
• The goal here is to catch any issues early before those small components are integrated with
the rest of the system.

• Unit tests help developers spot bugs early in the development process, making it easier and
quicker to fix them.
• It's the first layer of defense to verify that each part of the application performs as expected.

• Mainly features are:

• Testing individual functions or components.


• Ensuring correct behavior at the smallest level.
Integration Testing

• After unit testing, Integration Testing takes over.


• This level checks how different modules or components of the
software work together.
• It's important because even if individual parts work perfectly, they
might face issues when interacting with one another.
• Integration testing ensures that data flows correctly between modules
and that they communicate seamlessly.
• It helps catch problems that might arise when different parts of the
system interact.
System testing

• System Testing is when you test the software as a system.


• This stage checks whether the entire system functions as expected in
a real-world environment.
• It includes both functional and non-functional tests to ensure that
the software meets customer needs.
• Full end-to-end testing of the software.
• Verifying both functional and non-functional requirements.
• Testing the software's behavior in real-world conditions.
Acceptance Testing

• Acceptance Testing, also known as User Acceptance Testing (UAT), is the final test before
releasing the software to the end-users.
• In this phase, the customer or end-users verify if the software meets their needs and
expectations.

• UAT is crucial because it verify the software is ready for production.


• It’s the last chance to catch any overlooked issues before deployment. If the software
passes this stage, the customer gives the green light for release.

• Validating the software against business requirements.


• Ensuring the software meets customer expectations.
• Getting final approval from the customer.
Testing Strategies
• There are various testing strategies defined in software engineering literature,
all these strategies provide a testing template to the developers, and these
template should process following characteristics :

• Formal technical reviews must be conducted by the developer team.


• Testing starts from the component level and then finally complete computer-
based system is integrated at the end.
• Usually for smaller projects testing is conducted by the software developer
itself. For the larger projects an independent group is hired for conducting
effective testing.
• Debugging should be accommodated in testing strategies.
What Testing Shows ?
• Errors.
• Requirements conformance.
• Performance.
• An indication of quality.
A Strategy for Testing Conventional
Software
Levels of Testing for Conventional
Software
• Unit Testing – Begins at the center and each of the unit is
implemented in source code.
• Integration Testing – Focus is on design and
construction of software architecture.
• Validation Testing – Where requirements are validated
according to requirement analysis as narrated by the
customer in requirement analysis phase
• System Testing – All system elements are tested as
whole. In each turn of spiral the scope of testing is broaden
and thus computer software testing is completed.
Regression Testing

• Regression testing is the re-execution of some subset of tests that have


already been conducted to ensure that changes have not propagated
unintended side effects.
• Whenever software is corrected, some aspect of the software
configuration (the program, its documentation, or the data that support
it) is changed.
• Regression testing helps to ensure that changes (due to testing or for
other reasons) do not introduce unintended behavior or additional
errors.
• Regression testing may be conducted manually, by re-executing a subset
of all test cases or using automated capture/playback tools.

You might also like