Unit 4
Unit 4
Software Testing
Software Testing Strategies:
Testing strategy: It is a road map that incorporates test planning, test case design, test
execution and resultant data collection and execution.
Testing Strategies for Conventional Software:
I. Unit Testing
II. Integration Testing
III. Verification and Validation Testing
IV. System Testing
I. Unit Testing
• Unit testing involves the testing of each unit or an individual component of the
software application. It is the first level of functional testing.
• The aim behind unit testing is to validate unit components with its performance.
• A unit is a single testable part of a software system and tested during the
development phase of the application software.
There are several types of unit testing, each with its own advantages and use cases. The
three common types of unit testing:
1. White-box testing,
2. Black-box testing, and
3. Gray-box testing.
Black-box testing :
It treats the system as black box whose behavior can be determined by studying its
input and its related output not concerned with the internal structure of the program. It
focuses on the functional requirements of the software i.e. it enables the s/w engineer to
derive a set of input conditions that fully exercise all the functional requirements for
that program. It is concerned with functionality and implementation. Black box testing
is also called as Functional Testing.
There are three types of Black box Testing:- Black box testing can be applied to three main types of tests:
1. Functional,
2. Non-functional, and
3. Regression testing.
1. Functional Testing: Black box testing can test specific functions or features of the
software under test. for example, checking that it is possible to log in using correct
user credentials, and not possible to log in using wrong credentials.
2.Non-Functional Testing: Black box testing can check additional aspects of the
software, beyond features and functionality. A non-functional test does not check “if”
the software can perform a specific action but “how” it performs that action.
3.Regression Testing: Black box testing can be used to check if a new version of the
software exhibits a regression, or degradation in capabilities, from one version to the
next. Regression testing can be applied to functional aspects of the software (for
example, a specific feature no longer works as expected in the new version), or non-
functional aspects (for example, an operation that performed well is very slow in the
new version).
4.Boundary Value Analysis: Testers can identify that a system has a special response
around a specific boundary value. For example, a specific field may accept only values
between 0 and 99. Testers can focus on the boundary values (-1, 0, 99 and 100), to see
if the system is accepting and rejecting inputs correctly.
White Box testing:
It is also called glass box testing. It involves knowing the internal working of a
program. It guarantees that all independent paths will be exercised at least once. It
Exercises on all logical decisions and their true and false sides. Executes all loops
exercises all data structures for their validity. White box testing techniques are the basis
path testing and Control structure testing. It is also called as Structural Testing.
By combining black box and white box testing, testers can achieve a comprehensive
“inside and outside” inspection of a software application and increase coverage of
quality and security issues. It is called Grey Box Testing.
1. Condition Testing: It Exercises the logical conditions contained in a program module.
It also focuses on testing each condition in the program to ensure that it doesn’t
contain errors.
2. Data flow Testing: Selects test paths according to the locations of definitions and use
of variables in a program and aims to ensure that the definitions of variables and
subsequent and its use is tested.
3. Loop Testing: It is a type of software testing type that is performed to validate the
loops. It is one of the types of Control Structure Testing. Loop testing is a white box
testing technique and is used to test loops in the program. It focuses on the validity of
loop constructs four categories can be defined.
a. Simple loops
b. Nested loops
c. Concatenated loops and
d. Unstructured loops
a. Simple loop Testing: Testing performed in a simple loop is known as Simple
loop testing. Simple loop is basically a normal “for”, “while” or “do-while” in
which a condition is given and loop runs and terminates according to true and false
occurrence of the condition respectively. This type of testing is performed basically
to test the condition of the loop whether the condition is sufficient to terminate
loop after some point of time.
b. Nested Loop Testing: Testing performed in a nested loop in known as Nested loop
testing. Nested loop is basically one loop inside the loop. In nested loop there can be
finite number of loops inside a loop and there a nest is made. It may be either of any
of three loops i.e., for, while or do-while.
Example:
While (condition 1)
{
While (condition 2)
{
statement(s);
}
}
c. Concatenated loops: Testing: Testing performed in a concatenated loop is known
as Concatenated loop testing. It is performed on the concatenated loops.
Concatenated loops are loops after the loop. It is a series of loops. Difference
between nested and concatenated is that in nested loop is inside the loop but here
loop is after the loop.
Example:
while(condition 1)
{
statement(s);
}
while(condition 2)
{
statement(s);
}
d. Unstructured loops testing: Testing performed in an unstructured loop is known as
unstructured loop testing. Unstructured loop is the combination of nested and
concatenated loops. It is basically a group of loops that are in no order.
Example:
while()
{
for()
{}
while()
{}
}
It is the process of testing the interface between two software units or modules. It
focuses on determining the correctness of the interface. The purpose of integration
testing is to expose faults in the interaction between integrated units. Once all the
modules have been unit tested, integration testing is performed.
Integration testing is a software testing technique that focuses on verifying the
interactions and data exchange between different components or modules of a software
application. The goal of integration testing is to identify any problems or bugs that arise
when different components are combined and interact with each other. Integration testing
is typically performed after unit testing and before system testing
III. Verification and Validation Testing
Validation testing is the process of assessing a new software product to ensure that its
performance matches customer needs. Product development teams might perform
validation testing to learn about the integrity of the product itself and its performance
in different environments.
IV. System Testing
System testing is a type of software testing that evaluates the overall functionality
and performance of a complete and fully integrated software solution. It tests if the
system meets the specified requirements and if it is suitable for delivery to the
end-users. This type of testing is performed after the integration testing and before
the acceptance testing.
Example: Each component of the automobile, such as the seats, steering, mirror,
brake, cable, engine, car structure, and wheels, is made independently. After each
item is manufactured, it is tested separately to see whether it functions as intended.
Overall Testing types
Gorilla Testing
Smoke testing, also called build verification testing or confidence testing, is a software
testing method that is used to determine if a new software build is ready for the next
testing phase. This testing method determines if the most crucial functions of a program
work but does not delve into finer details.
The art of debugging :
Debugging is the process of identifying and resolving errors, or bugs, in a
software system. It is an important aspect of software engineering because
bugs can cause a software system to malfunction, and can lead to poor
performance or incorrect results. Debugging can be a time-consuming and
complex task, but it is essential for ensuring that a software system is
functioning correctly.
b. Debugging Tools: There are various tools available for debugging such as
debuggers, trace tools, and profilers that can be used to identify and resolve bugs.
e. System Testing: This involves testing the entire software system to identify bugs or
errors.
f. Monitoring: This involves monitoring a software system for unusual behavior or
performance issues that can indicate the presence of bugs or errors.
g. Logging: This involves recording events and messages related to the software
system, which can be used to identify bugs or errors.
Metrics for Process and Products:
Software measurement:
Product Metrics:
Product metrics in software engineering refer to the quantifiable measurements
used to assess the characteristics and performance of software products throughout
their development and maintenance lifecycle. These metrics provide valuable
insights into various aspects of software quality, effectiveness, efficiency, and
reliability.
Measure:
Provides a quantitative indication of the extent, amount, dimension, capacity or size of some attribute of a
product or process
Product Metrics for analysis, Design, Test and maintenance:
It is designed to estimate and measure the time, and thereby the cost, of
developing new software applications and maintaining existing software
applications.
The main other approach used for measuring the size, and therefore the time
required, and the software project lines of code (LOC)
Function Point Analysis:
Adjustment calculation:
Adjusted FP = Unadjusted FP X [0.65 + (adjustment factor /100)]
= 240 X [0.65 + ( 17 /100)]
= 240 X [0.82]
= 197 adjusted function points
But how long will the project take and how much will it cost?
If the average programmer is paid $5,200 per month (including benefits), then the
[labor] cost of the project will be . . .
11 man-months X $5,200 = $57,200
Because function point analysis is independent of language used, development
platform, etc. it can be used to identify the productivity benefits of . . .
• One programming language over another
• One development platform over another
• One development methodology over another
• One programming department over another
• Before-and-after gains in investing in programmer training
Factors that affect software quality can be categorized in two broad groups:
1. Factors that can be directly measured (e.g. defects uncovered during testing)
2. Factors that can be measured only indirectly (e.g. usability or maintainability)
.
The measures of software quality are correctness, maintainability, integrity, and
usability. These measures will provide useful indicators for the project team.
Correctness: Correctness is the degree to which the software performs its required
function. The most common measure for correctness is defects per KLOC, where a
defect is defined as a verified lack of conformance to requirements
Threat is the probability (which can be estimated or derived from empirical evidence)
that an attack of a specific type will occur within a given time.
Security is the probability (which can be estimated or derived from empirical
evidence) that the attack of a specific type will be repelled. The integrity of a system
can then be defined as