Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 170

Noida Institute of Engineering and Technology, Greater Noida

Introduction

Unit: 4

Software Engineering
Dr Nidhi Sharma
AIT0401
Assistant Professor
(B Tech IVth Sem) (CSDS)

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


1
02/06/2024
Software Testing (CO4)

• Testing is a set of activities that can be planned in advance and


conducted systematically. For this reason a template for software
testing- a set of steps into which we can place specific test case
design techniques and testing method should be defined for the
software process.
• Testing have the following generic characteristics.
– To perform effective testing, a software team should conduct
effective formal technical reviews. By doing this many errors will
be eliminated before testing commence.

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 2
Objective of Testing

• The testing objective is to test the code whereby there is a high


probability of discovering all errors.
• This objective also demonstrates that the software functions are
working according to software requirements specifications (SRS)
with regard to functionality, features, facilities and performance.
• Testing objectives are
– Testing is a process of executing a program with the intent of
finding an error.
– A good test case is one that has a high probability of finding an
as yet undiscovered error

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 3
Some Terminologies

Bug : In software testing, a bug is the informal name of defects, which means
that software or application is not working as per the requirement. When we
have some coding error, it leads a program to its breakdown, which is known
as a bug. The test engineers use the terminology Bug.
Defects : When the application is not working as per the requirement is
knows as defects. It is specified as the aberration from the actual and
expected result of the application or software. In other words, we can say
that the bug announced by the programmer and inside the code is called a
Defect.
Error: The Problem in code leads to errors, which means that a mistake can
occur due to the developer's coding error as the developer misunderstood
the requirement or the requirement was not defined correctly.
The developers use the term error.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 4


Some Terminologies

Fault: The fault may occur in software because it has not added the code for
fault tolerance, making an application act up. A fault may happen in a
program because of the following reasons:
• Lack of resources
• An invalid step
• Inappropriate data definition

Failure: Many defects lead to the software's failure, which means that a loss
specifies a fatal issue in software/ application or in its module, which makes
the system unresponsive or broken. In other words, we can say that if an end-
user detects an issue in the product, then that particular issue is called
a failure. Possibilities are there one defect that might lead to one failure or
several failures. For example, in a bank application if the Amount
Transfer module is not working for end-users when the end-user tries
to transfer money, submit button is not working. Hence, this is a failure.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 5
Some Terminologies

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 6


Some Terminologies

Fault, defect, or bug


Error or mistake

Failure

Specification Design Code

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 7
A Few Error Facts

• Even experienced programmers make many errors:

– Avg. 50 bugs per 1000 lines of source code

• Extensively tested software contains:

– About 1 bug per 1000 lines of source code.

• Bug distribution:
Bug Source
– 60% spec/design, 40% implementation.
Spec and
Design
Code

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 8
How to Reduce Bugs?

• Review

• Testing

• Formal specification and verification

• Use of development process

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 9


How to Test?

• Check if the program behaved as expected.


• Input test data to the program.

• Observe the output:

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 10


Testing Facts

• Consumes the largest effort among all development activities:


– Largest manpower among all roles
– Implies more job opportunities
• About 50% development effort
– But 10% of development time?
– How?
Testing is getting more complex and sophisticated every year.
– Larger and more complex programs
– Newer programming paradigms
– Newer testing techniques
– Test automation
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 11
Test How Long?

One way:
# Bugs

• Another way: Time


– Seed bugs… run test cases

– See if all (or most) are getting detected

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 12


Test, Test Case and Test Suite (CO4)

• A test case is a unit of testing that defines what to test, while


a test suite is a collection of test cases grouped for a specific
purpose.
• A test case can include inputs and outputs, step-by-step
instructions, and the expected result. For example, a test case
can check login functionality, such as when a valid login ID and
password are entered.
• A test suite can contain multiple test cases, each with a
separate test script. For example, a test suite might contain
four test cases, each with a different purpose, such as: Login,
Add new products, Checkout, and Logout.

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 13
Test, Test Case and Test Suite (CO4)

• Test and Test case terms are used interchangeably. In practice, both
are same and are treated as synonyms. Test case describes an input
description and an expected output description
• The set of test cases is called a test suite. Hence any combination of
test cases may generate a test suite.

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 14
Verification and Validation

• Verification: Software should confirm to its.(are we building the product


right?)
– It is the process of determining whether the output of one phase of
software development conforms to that of its previous phase. Thus
verification is concerned with phase containment of errors

• Validation: Software should do what the user really require.(are we


building the right product?)
– It is the process of determining whether a fully developed system
conforms to its requirements specification. the aim of validation is
that the final product be error free.

Testing= Verification + Validation

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 15


Verification and Validation

• Verification is the process of determining:


–Whether output of one phase of development conforms to its previous
phase.

• Validation is the process of determining:

–Whether a fully developed system conforms to its SRS document..

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 16


Verification and Validation

• Verification is the process of determining:


–Whether output of one phase of development conforms to its previous
phase.

• Validation is the process of determining:

–Whether a fully developed system conforms to its SRS document..

• Verification is concerned with phase containment of errors:

–Whereas, the aim of validation is that the final product is error free.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 17


Verification and Validation

Verification and Validation Techniques


• System testing
• Review

• Simulation

• Unit testing

• Integration testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 18


Verification and Validation

Verification Validation
Are you building it right? Have you built the right thing?

Checks whether an artifact Checks the final product


conforms to its previous against the specification.
artifact.
Done by developers. Done by Testers.
Static and dynamic activities: Dynamic activities:
reviews, unit testing. Execute software and
check against
requirements.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 19


Software Testing Principles

• Principle 1. Testing shows presence of defects


Hence, testing principle states that – Testing talks about the presence of
defects and don’t talk about the absence of defects. i.e. Software Testing
reduces the probability of undiscovered defects remaining in the software but
even if no defects are found, it is not a proof of correctness.

• Principle 2. Exhaustive testing is not possible


Yes! Exhaustive testing (software testing technique that involves testing every
possible combination of inputs and scenarios to ensure that a software system
functions properly in every situation) is not possible. Instead, we need the
optimal amount of testing based on the risk assessment of the application.

• Principle 3. Early testing


Early Testing – Testing should start as early as possible in the Software
Development Life Cycle. So that any defects in the requirements or design
phase are captured in early stages. It is much cheaper to fix a Defect in the
early stages of testing.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software 20
Engineering Unit IV
Software Testing Principles

• Principle 4. Defect clustering


Defect Clustering which states that a small number of modules contain most
of the defects detected. This is the application of the Pareto Principle to
software testing: approximately 80% of the problems are found in 20% of the
modules.

• Principle 5. Pesticide paradox


Repetitive use of the same pesticide mix to eradicate insects during farming
will over time lead to the insects developing resistance to the pesticide
Thereby ineffective of pesticides on insects. The same applies to software
testing. Testers cannot simply depend on existing test techniques. He must
look out continually to improve the existing methods to make testing more
effective.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software 21


Engineering Unit IV
Software Testing Principles

• Principle 6. Testing is context dependent


Testing is context dependent which basically means that the way you test an e-
commerce site will be different from the way you test a commercial off the
shelf application. All the developed software’s are not identical. You might use
a different approach, methodologies, techniques, and types of testing
depending upon the application type. For instance testing, any POS system at
a retail store will be different than testing an ATM machine.

• Principle 7. Absence of errors fallacy


It is possible that software which is 99% bug-free is still unusable. This can be
the case if the system is tested thoroughly for the wrong requirement.
Software testing is not mere finding defects, but also to check that software
addresses the business needs. The absence of Error is a Fallacy i.e. Finding
and fixing defects does not help if the system build is unusable and does not
fulfill the user’s needs & requirements.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software 22


Engineering Unit IV
Testing Levels

4 Testing Levels
• Software tested at 4 levels:

–Unit testing

–Integration testing

–System testing

–Acceptance testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 23


Levels of Testing

• Unit testing
– Test each module (unit, or component) independently
– Mostly done by developers of the modules
• Integration and system testing
– Test the system as a whole
– Often done by separate testing or QA team
• Acceptance testing
– Validation of system functions by the customer

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 24


Levels of Testing

Testing levels are the procedure for finding the missing areas and
avoiding overlapping and repetition between the development life
cycle stages.
• Unit testing is the first level of software testing, which is used to
test if software modules are satisfying the given requirement or
not.
• The primary purpose of executing unit testing is to validate unit
components with their performance.
• A unit component is an individual function or regulation of the
application, or we can say that it is the smallest testable part of the
software. The reason of performing the unit testing is to test the
correctness of inaccessible code.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 25


Levels of Testing

Integration Testing
• The second level of software testing is the integration testing.
• It is mainly used to test the data flow from one module or
component to other modules.
• In integration testing, the test engineer tests the units or separate
components or modules of the software in a group.
System Testing
• The third level of software testing is system testing, which is used
to test the software's functional and non-functional requirements.
• It is end-to-end testing where the testing environment is parallel to
the production environment. In the third level of software
testing, we will test the application as a whole system.
• To check the end-to-end flow of an application or the software as a
user is known as System testing.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 26
Levels of Testing

Acceptance Testing
• The last and fourth level of software testing is acceptance testing,
which is used to evaluate whether a specification or the
requirements are met as per its delivery.
• The software has passed through three testing levels (Unit Testing,
Integration Testing, System Testing). Some minor errors can still be
identified when the end-user uses the system in the actual
scenario.
• Acceptance testing is the squeezing of all the testing processes
that are previously done.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 27


Levels of Testing
Regression Testing
• Regression Testing is the process of testing the modified parts of the code and
the parts that might get affected due to the modifications to ensure that no new
errors have been introduced in the software after the modifications have been
made.
• Regression means the return of something and in the software field, it refers to
the return of a bug.
Process of Regression testing
• Firstly, whenever we make some changes to the source code for any reason like
adding new functionality, optimization, etc. then our program when executed
fails in the previously designed test suite for obvious reasons.
• After the failure, the source code is debugged to identify the bugs in the
program. After identification of the bugs in the source code, appropriate
modifications are made. Then appropriate test cases are selected from the
already existing test suite which covers all the modified and affected parts of the
source code.
• We can add new test cases if required. In the end, regression testing is
performed using the selected test cases.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 28
Levels of Testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 29


Levels of Testing

Techniques for the selection of Test cases for Regression Testing


Select all test cases: In this technique, all the test cases are selected from the
already existing test suite. It is the simplest and safest technique but not very
efficient.
Select test cases randomly: In this technique, test cases are selected
randomly from the existing test suite, but it is only useful if all the test cases
are equally good in their fault detection capability which is very rare. Hence,
it is not used in most of the cases.
Select modification traversing test cases: In this technique, only those test
cases are selected that cover and test the modified portions of the source
code and the parts that are affected by these modifications.
Select higher priority test cases: In this technique, priority codes are
assigned to each test case of the test suite based upon their bug detection
capability, customer requirements, etc. After assigning the priority codes, test
cases with the highest priorities are selected for the process of regression
testing.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 30


Levels of Testing

Tools for Regression testing


The most commonly used tools for regression testing are:
• Selenium
• WATIR (Web Application Testing In Ruby)
• QTP (Quick Test Professional)
• RFT (Rational Functional Tester)
• Winrunner
• Silktest

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 31


Levels of Testing

Acceptance
What users
testing
really need

Sy stin
ste g
Te

m
System testing
Requirements

In
te
Integration testing

tio tin

gr
Design

n
te

a
s
g Unit testing
Code

Un tin
te
it g
s

Maintenance Regression Testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 32


Overview of Activities During System and Integration
Testing

• Test Suite Design


• Run test cases Tester
• Check results to detect failures.

• Prepare failure list

• Debug to locate errors


Developer
• Correct errors.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 33


Unit testing

• During unit testing, functions (or modules) are tested in isolation:

–What if all modules were to be tested together (i.e. system testing)?

•It would become difficult to determine which module has the error.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 34


Integration Testing

• After modules of a system have been coded and unit tested:

–Modules are integrated in steps


according to an integration plan

–The partially integrated system is tested at each integration


step.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 35


Integration and System Testing

• Integration test evaluates a group of functions or classes:

– Identifies interface compatibility, unexpected parameter values or state


interactions, and run-time exceptions

– System test tests working of the entire system

• Smoke test:

– System test performed daily or several times a week after every build.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 36


Types of System Testing

• Based on types test:


– Functionality test
– Performance test
• Based on who performs testing:
– Alpha
– Beta
– Acceptance test

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 37


Performance test

• Determines whether a system or subsystem meets its non-functional


requirements:
• Response times
• Throughput
• Usability
• Stress
• Recovery
• Configuration, etc.

62

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 38


User Acceptance Testing

• User determines whether the system fulfills his requirements

– Accepts or rejects delivered system based on the test results.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 39


Who Tests Software?

• Programmers:
– Unit testing
– Test their own or other’s programmer’s code
• Users:
– Usability and acceptance testing
– Volunteers are frequently used to test beta versions
• Test team:
– All types of testing except unit and acceptance
– Develop test plans and strategy

64

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 40


V&V

Feasibility Study

Req. Analysis

Design
Testing by
developers
Coding
Testing by Tester
Review,
Simulation, Testing
etc.
Maintenance

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 41


Test Cases

• Each test case typically tries to establish correct working of some


functionality:

– Executes (covers) some program elements.

– For certain restricted types of faults, fault-based testing can be


used.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 42


Test data versus test cases

• Test data:
– Inputs used to test the system

• Test cases:

– Inputs to test the system,

– State of the software, and

– The predicted outputs from the inputs

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 43


Test Cases and Test Suites

• A test case is a triplet [I,S,O]

–I is the data to be input to the system,

–S is the state of the system at which the data will be input,

–O is the expected output of the system.

• Test a software using a set of carefully designed test


cases:

–The set of all test cases is called the test suite.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 44


What are Negative Test Cases?

• Purpose:
– Helps to ensure that the application gracefully handles
invalid and unexpected user inputs and the application does
not crash.
• Example:
– If user types letter in a numeric field, it should not crash
but politely display the message: “incorrect data type,
please enter a number…”

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 45


Test Execution Example: Return Book

Test case [I,S,O]

1. Set the program in the required state: Book record created,


member record created, Book issued
2. Give the defined input: Select renew book option and request
renew for a further 2 week period.
3. Observe the output:
Compare it to the expected output.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 46


Sample: Recording of Test Case & Results

Test Case number


Test Case author
Test purpose Pre-
condition: Test inputs:
Expected outputs (if any):
Post-condition:
Test Execution history:
Test execution date
Person executing Test
Test execution result (s) : Pass/Fail
If failed : Failure information and fix status

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 47


Test Team- Human Resources

• Test Planning: Experienced people


• Test scenario and test case design: Experienced and test qualified people
• Test execution: semi-experienced to inexperienced
• Test result analysis: experienced people
• Test tool support: experienced people
• May include external people:
– Users
– Industry experts

79

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 48


Why Design of Test Cases?

• Exhaustive testing of any non-trivial system is impractical: –Input data domain


is extremely large.

• Design an optimal test suite, meaning: –Of reasonable


size, and

–Uncovers as many errors as possible.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 49


Stub & Driver

Stubs and drivers are two types of test harness that are a collection of
software and test, which means they are designed together to test a
unit of a program by accelerating the change of situations at the same
time as regularly checking its performances and results.
What are Stubs?
A stub is a replica of a module that collects the data and develops
many possible data. However, it executes like an actual module and is
mainly used to test modules.
Generally, stubs are created by software developers in order to use
them instead of modules if the particular modules are miss or not yet
developed.
By using these test stubs, the test engineers can simulate the
performance of the lower-level modules, which are not yet joined with
the software. Furthermore, it helps us to accelerate the activity of the
missing modules.
Types of Stubs
In the top-down approach of incremental integration testing, the
stubs are divided into four essential parts, which are as follows:
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 50
Stub & Driver

• Demonstrate the trace message.


• Exhibits the parameter values.
• Returns the consistent values, which are handled by the modules or the
components.
• Returns the values of the specific parameters, which were utilized by testing
components or modules.
What are Drivers?
The Drivers establish the test environments and takes care of the communication,
estimates results, and also sends the reports.
These are just like stubs and used by software test engineers in order to
accomplish the missing or incomplete modules/ components requirements.
The drivers are mainly developed in the Bottom-up approach of incremental
integration testing.
Generally, drivers are bit complex as compared to the stubs.
These can test the lower levels of the code when the upper-level modules or
codes are not developed or missing.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 51


Stub & Driver

Examples of Stubs and Drivers


Let us see an example of stubs and drivers, which help us to enhance our knowledge of
stubs and drivers.
Suppose we have one web application that contains four different modules, such as:
Module-P
Module-Q

Once Module-P is developed, it will go through the testing process. But, to perform
and validate the testing methods regarding Module-P, they need Module-Q, which
is not yet developed entirely and still in the developing process.
And it is not possible to test Module-P on the lack of Module-Q. Thus, in such
scenarios, we will take the help of Stubs and Drivers in the software testing
process.
The Stubs and drivers will replicate all the basic functionality and features displayed
by the real Module-Q. And subsequently, it is being combined with Module-P in
order to execute the testing process effectively.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 52
Stub & Driver

The key difference between Stubs and Drivers


• Stubs and Drivers design as a dummy for the missing or inaccessible modules or
the components.
• Most commonly, stubs and drivers are used in the incremental integration testing,
where stubs are used in top-bottom methodology while drivers are used in
a bottom-up methodology.
• Usually, developers and unit test engineers are included in the creation of stubs and
drivers.
• Even though it provides an ease to perform the separate components or the
modules without worrying about the accessibility of other modules, and leads them
into a time-consuming process, as it involves the development of replica for all the
missing modules.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 53


Alpha testing and Beta testing

Alpha testing is a type of acceptance testing, which is performed to identify all


possible bugs/issues before releasing the product to the end-user. Alpha test is a
preliminary software field test carried out by a team of users to find out the bugs that
were not found previously by other tests. Alpha testing implies a meeting with a
software vendor and client to ensure that the developers appropriately meet the
client's requirements in terms of the performance, functionality, and durability of the
software.

Beta Testing is a type of acceptance testing; it is the final test before shipping a
product to the customers. Beta testing of a product is implemented by "real users "of
the software application in a "real environment." In this phase of testing, the
software is released to a limited number of end-users of the product to obtain
feedback on the product quality. It allows the real customers an opportunity to
provide inputs into the design, functionality, and usability of the product. These
inputs are essential for the success of the product. Beta testing reduces product
failure risks and increases the quality of the product through customer validation.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 54


Alpha testing and Beta testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 55


Alpha testing and Beta testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 56


White Box & Black Box Testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 57


Structural Testing

Structural Testing
• Structural testing, also known as glass box testing or white box testing is an
approach where the tests are derived from the knowledge of the software's
structure or internal implementation.
• The other names of structural testing includes clear box testing, open box
testing, logic driven testing or path driven testing.

 Calculating Structural Testing Effectiveness:


• Statement Testing = (Number of Statements Exercised / Total Number of
Statements) x 100 %
• Branch Testing = (Number of decisions outcomes tested / Total Number of
decision Outcomes) x 100 %
• Path Coverage = (Number paths exercised / Total Number of paths in the
program) x 100 %

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 58


Structural Testing

Advantages of Structural Testing:


• Forces test developer to reason carefully about implementation
• Reveals errors in "hidden" code
• Spots the Dead Code or other issues with respect to best programming practices.
Disadvantages of Structural Box Testing:
• Expensive as one has to spend both time and money to perform white box
testing.
• Every possibility that few lines of code is missed accidentally.
• Indepth knowledge about the programming language is necessary to perform
white box testing.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 59


Functional Testing

Functional Testing
Functional Testing is a testing technique that is used to test the
features/functionality of the system or Software, should cover all the scenarios
including failure paths and boundary cases.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 60


Functional Testing

Complete process to perform functional testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 61


Functional Testing

Complete process to perform functional testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 62


Functional Testing

Types of functional testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 63


Functional Testing

Static testing helps to find the error in the early stages. With the help of static
testing, this will reduce the development timescales. It reduces the testing cost
and time. Static testing also used for development productivity.
Component Testing: Component Testing is also a type of software testing in
which testing is performed on each component separately without integrating
with other parts. Component testing is also a type of black-box testing.
Component testing also referred to as Unit testing, program testing, or module
testing.
Grey Box Testing: Grey Box Testing defined as a combination of both white
box and black-box testing. Grey Box testing is a testing technique which
performed with limited information about the internal functionality of the
system.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 64


Functional Testing

Ad-hoc testing: Ad-hoc testing is an informal testing type whose aim is to break
the system. This type of software testing is unplanned activity. It does not follow
any test design to create the test cases. Ad-hoc testing is done randomly on any
part of the application; it does not support any structured way of testing.
Recovery Testing: Recovery testing is used to define how well an application
can recover from crashes, hardware failure, and other problems. The purpose of
recovery testing is to verify the system's ability to recover from testing points of
failure.
Database Testing: Database testing is a type of testing which checks the schema,
tables, triggers, etc. of the database under test. Database testing may involve
creating complex queries to load/stress test the database and check its
responsiveness. It checks the data integrity and consistency.
Retesting: Retesting is a type of testing performed to check the test cases that
were unsuccessful in the final execution are successfully pass after the defects
fixed. Usually, tester assigns the bug when they find it while testing the product or
its component. The bug allocated to a developer, and he fixes it. After fixing, the
bug is assigned to a tester for its verification. This testing is known as retesting.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 65
Functional Testing

Smoke Testing: Functional testing by smoke testing. Smoke testing includes


only the basic (feature) functionality of the system. Smoke testing is known as
"Build Verification Testing." Smoke testing aims to ensure that the most
important function work.
For example, Smoke testing verifies that the application launches successfully
will check that GUI is responsive.
Sanity Testing: Sanity testing involves the entire high-level business scenario is
working correctly. Sanity testing is done to check the functionality/bugs fixed.
Sanity testing is little advance than smoke testing.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 66


Functional Testing

Advantages of Functional Testing


• It produces a defect-free product.
• It ensures that the customer is satisfied.
• It ensures that all requirements met.
• It ensures the proper working of all the functionality of an
application/software/product.
• It ensures that the software/ product work as expected.
• It ensures security and safety.
• It improves the quality of the product.
Disadvantages of functional testing are:
• Functional testing can miss a critical and logical error in the
system.
• This testing is not a guarantee of the software to go live.
• The possibility of conducting redundant testing is high in
functional testing.
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 67
Design of Test Cases

• If test cases are selected randomly:


–Many test cases would not contribute to the significance of the test suite,
–Would only detect errors that are already detected by other test cases in
the suite.
• Therefore, the number of test cases in a randomly selected test
suite:
–Does not indicate the effectiveness of testing
• Testing a system using a large number of randomly selected test cases:
–Does not mean that most errors in the system will be uncovered.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 68


Example

Find the maximum of two integers x and y.


• The code has a simple programming error:
• If (x>y) max = x;
else max = x; // should be max=y;

• Test suite {(x=3,y=2);(x=2,y=3)} can detect the bug,


• A larger test suite {(x=3,y=2);(x=4,y=3); (x=5,y=1)} does not detect the bug.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 69


Test Plan

• Before testing activities start, a test plan is developed.


• The test plan documents the following:
– Features to be tested
– Features not to be tested
– Test strategy
– Test suspension criteria
– stopping criteria
– Test effort
– Test schedule

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 70


Unit Testing

When and Why of Unit Testing?


•Unit testing carried out:
• After coding of a unit is complete and it compiles successfully.

• Unit testing reduces debugging effort substantially.

• Without unit test:

– Errors become difficult to track down.


– Debugging cost increases substantially…

Failure

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 71


Unit Testing

• Testing of individual methods, modules, classes, or components in isolation:


– Carried out before integrating with other parts of the software
being developed.

• Following support required for Unit testing:


– Driver
• Simulates the behavior of a function that calls and supplies
necessary data to the function being tested.
– Stub
• Simulates the behavior of a function that has not yet been written.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 72


Unit Testing

PROCEDURE
STUB UNDER TEST DRIVER
CALL

Access To Nonlocal
Variables

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 73


Design of Unit Test Cases

• There are essentially three main approaches to design test cases:

–Black-box approach

–White-box (or glass-box) approach

–Grey-box approach

13

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 74


Black-Box Testing

• Test cases are designed using only functional specification of the software:
–Without any knowledge of the internal structure of the software.

Software
Input Output

• Black-box testing is also known as functional testing.

14

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 75


What is Hard about BB Testing

• Data domain is large

• A function may take multiple parameters:

– We need to consider the combinations of the values of the


different parameters

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 76


White-box Testing

• To design test cases:


–Knowledge of internal structure of software
necessary.

–White-box testing is also called structural testing.

18

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 77


Black Box Testing

• Software considered as a black box:


–Test data derived from the specification
• No knowledge of code necessary
• Also known as:
– Data-driven or
– Input/output driven testing
• The goal is to achieve the thoroughness of exhaustive input testing:
–With much less effort!!!!

System
Input Output

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 78


Black-Box Testing

• Boundary Values analysis


• Robustness Testing
• Worst case Testing
• Equivalence Class Testing
• Decision Table Based Testing

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 79


Equivalence Class Partitioning

–Identify scenarios

–Examine the input data.

–Examine output
• Few guidelines for determining the equivalence classes can be given…

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 80


Guidelines to Identify Equivalence Classes

•If an input is a range, one valid and two invalid equivalence classes
are defined. Example: 1 to 100 1 100
•If an input is a set, one valid and one invalid equivalence classes are
defined. Example: {a,b,c}

•If an input is a Boolean value, one valid and one invalid class are defined.

Example:

•Area code: input value defined between 10000 and 90000--- range

•Password: string of six characters ---set

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 81


Example

• Given three sides, determine the type of the triangle:


– Isosceles
– Scalene
– Equilateral, etc.

• Hint: scenarios correspond to output in this case.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 82


Equivalence Partitioning

• First-level partitioning:
– Valid vs. Invalid test cases
Valid Invalid

• Further partition valid and invalid


test cases into equivalence classes

Invalid
Valid
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 83
Equivalence Partitioning

• Create a test case using at


least one value from each
equivalence class

Invalid
Valid

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 84


Special Value Testing

• What are special values?

– The tester has reasons to believe that execution with certain values
may expose bugs:

–General risk: Example-- Boundary value testing

–Special risk: Example-- Leap year not considered

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 85


Boundary Value Analysis

• Some typical programming errors occur:

–At boundaries of equivalence classes

–Might be purely due to psychological factors.

1 100
• Programmers often commit mistakes in the:

–Special processing at the boundaries of equivalence classes.

54

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 86


Boundary Value Analysis

Boundary Value Analysis


• Programmers may improperly use < instead of <=

• Boundary value analysis:


–Select test cases at the boundaries of different equivalence classes.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 87


Boundary Value Analysis: Guidelines

• If an input is a range, bounded by values a and b:


– Test cases should be designed with value a and b, just above and
below a and b.

• Example 1: Integer D with input range [-3, 10],


– test values: -3, 10, 11, -2, 0
• Example 2: Input in the range: [3,102]
– test values: 3, 102, -1, 200, 5

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 88


Boundary Value Testing Example

• Process employment applications based on a person's age.

0-16 Do not hire


16-18 May hire on part time basis
18-55 May hire full time
55-99 Do not hire

• Notice the problem at the boundaries.

– Age "16" is included in two different equivalence classes (as are 18


and 55).

57
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 89
Boundary Value Testing: Code Example

• If (applicantAge >= 0 && applicantAge <=16) hireStatus="NO";

• If (applicantAge >= 16 && applicantAge <=18) hireStatus="PART";

• If (applicantAge >= 18 && applicantAge <=55) hireStatus="FULL";

• If (applicantAge >= 55 && applicantAge <=99) hireStatus="NO";

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 90


Boundary Value Testing Example (cont)

• Corrected boundaries:
0–15 Don't hire
16–17 Can hire on a part-time basis only
18–54
Can hire as full-time employees
55–99
Don't hire

• What about ages -3 and 101?

• The requirements do not specify how these values should be


treated.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 91


Boundary Value Analysis

• Create test cases to test boundaries of equivalence classes

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 92


Boundary Value Testing Example (cont)

• The code to implement the corrected rules is:

If (applicantAge >= 0 && applicantAge hireStatus="NO";


<=15) If (applicantAge >= 16 && hireStatus="PART"
applicantAge <=17) If (applicantAge >= 18 ;
&& applicantAge <=54) If (applicantAge >= hireStatus="FULL";
55 && applicantAge <=99) hireStatus="NO";

• Special values on or near the boundaries in this example are {-1, 0, 1}, {14,
15, 16}, {17, 18, 19}, {54, 55, 56}, and {98, 99, 100}.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 93


Example 1

• For a function that computes the square root of an integer in the range of 1
and 5000:

–Test cases must include the values:


{0,1,2,4999,5000,5001}.

1
5000

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 94


Example 2

• Consider a program that reads the “age” of employees


and computes the average age.
input (ages)→ Program→ output: average age

Assume valid age is 1 to


150
1 150
• How would you test this?
– How many test cases would you generate?

– What type of test data would you input to test this


program?

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 95


63
Boundaries of the inputs

The “basic” boundary value


testing
would include 5 test cases:
predict-longevity(age)
1. - at minimum boundary
2. - immediately above
minimum 1 <= age <=
3. - between minimum
and maximum (nominal)
1 150 age 150
150

4. - immediately below
maximum
5. - at maximum
boundary 64

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 96


Boundary Value Testing Example (cont)

How many test cases for the example ?

• Test input values? :


1 at the minimum predict-longevity(age)

2 at one above minimum


45 at middle
149 at one below maximum
150 at maximum

65

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 97


Decision table based testing

• Applicable to requirements involving conditional actions. • This is


represented as a decision table:
–Conditions = inputs
–Actions = outputs
–Rules =test cases
Rule1 Rule2 Rule3 Rule4
• Assume independence of inputs
No
• Example Condition1
Condition2
Yes
Yes
Yes No
No
X

–If c1 AND c2 OR c3 then A1 Condition3 No X No X


Condition4 No Yes No Yes
Yes

Action1 Yes Yes No No


Action2 No No Yes No
Action3 No No No Yes

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 98


Example

Conditions
C1: a < b+c? F T T T T T T T T T T
C2: b < a+c? - F T T T T T T T T T
C3: c < a+b? - - F T T T T T T T T
C4: a=b? - - - T T T T F F F F
C5: a=c? - - - T T F F T T F F
C6: b-c? - - - T F T F T F T F
Actions
A1: Not a Triangle X X X
A2: Scalene X
A3: Isosceles X X X
A4: Equilateral X
A5: Impossible X X X

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 99


Example (cont)

Case ID a b c Expected
Output
DT1 4 1 2 Not a
Triangle
DT2 1 4 2 Not a
Triangle
DT3 1 2 4 Not a
Triangle
DT4 5 5 5 Equilateral

DT5 ? ? ? Impossible

DT6 ? ? ? Impossible

DT7 2 2 3 Isosceles

DT8 ? ? ? Impossible

DT9 2 3 2 Isosceles

DT10 3 2 2 Isosceles

DT11 3 4 5 Scalene

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 100


White Box Testing(Structural Testing)

• It is a complementary approach to functional testing. It


permits us to examine the internal structure of the
program.
• Also called Structural Testing

1. Path Testing
2. Cyclomatic Complexity
3. Graph Matrices
4. Data Flow Testing
5. Mutation Testing

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 101
Unit IV
Why Both BB and WB Testing?

White-box
Black-box
• Impossible to write a test case for • Does not address the question of
every possible set of inputs and whether a program matches the
outputs specification
• Some code parts may not be • Does not tell if all functionalities
reachable have been implemented
• Does not tell if extra
• Does not uncover any missing
functionality has been
program logic
implemented.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 102


Example

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 103


Example

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 104


Example

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 105


Example

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 106


Example

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 107


Alpha, Beta and Acceptance Testing (CO4)

The term Acceptance Testing is used when the software is developed for
a specific customer. A series of tests are conducted to enable the customer
to validate all requirements. These tests are conducted by the end user /
customer and may range from adhoc tests to well planned systematic
series of tests.

The terms alpha and beta testing are used when the software is developed
as a product for anonymous customers.

Alpha Tests are conducted at the developer’s site by some potential


customers. These tests are conducted in a controlled environment. Alpha
testing may be started when formal testing process is near completion.

Beta Tests are conducted by the customers / end users at their sites.
Unlike alpha testing, developer is not present here. Beta testing is
conducted in a real environment that cannot be controlled by the developer.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 108
Unit IV
Testing Methodology

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 109


Black Box Testing(CO4)

• Test cases are designed from an examination of the


input/output values only and no knowledge of design, or
code is required.
• Also called Functional Testing

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 110
Unit IV
Functional Testing

The following are the main approaches to designing black box test
cases.

1. Boundary Values analysis


2. Robustness Testing
3. Worst case Testing
4. Equivalence Class Testing
5. Decision Table Based Testing

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 111
Unit IV
Boundary Value Analysis

Consider a program with two input variables x and y. These


input variables
have specified boundaries as:

a≤x≤b
c≤y≤d

Fig. : Input domain for program having two input


variables

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 112
Unit IV
Boundary Value Analysis

The boundary value analysis test cases for our program with two
inputs variables (x and y) that may have any value from 100 to 300
are: (200,100), (200,101), (200,200), (200,299), (200,300), (100,200),
(101,200), (299,200) and (300,200). This input domain is shown in Fig.
8.5. Each dot represent a test case and inner rectangle is the domain
of legitimate inputs. Thus, for a program of n variables, boundary
value analysis yield 4n + 1 test cases

Fig. : Input domain of two variables x and y with boundaries


[100,300] each
Dr. Nidhi Sharma ACSE0603 Software Engineering
02/06/2024 113
Unit IV
Example

Consider a program for the determination of the nature of roots of a


quadratic equation. Its input is a triple of positive integers (say a,b,c)
and values may be from interval [0,100]. The program output may
have one of the following words.
[Not a quadratic equation; Real roots; Imaginary roots; Equal roots]
Design the boundary value test cases.

Quadratic equation will be of type:


ax2+bx+c=0
Roots are real if (b2-4ac)>0
Roots are imaginary if (b2-4ac)<0
Roots are equal if (b2-4ac)=0
Equation is not quadratic if a=0
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 114
Example

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 115


Robustness Testing

It is nothing but the extension of boundary value analysis. Here, we


would like to see, what happens when the extreme values are
exceeded with a value slightly greater than the maximum, and a value
slightly less than minimum. It means, we want to go outside the
legitimate boundary of input domain

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 116


Worst-case testing

If we reject “single fault” assumption theory of reliability and may


like to see what happens when more than one variable has an
extreme value. In electronic circuits analysis, this is called “worst
case analysis”. It is more thorough in the sense that boundary value
test cases are a proper subset of worst case test cases. It requires
more effort.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 117


Equivalence Class Testing

In this method, input domain of a program is partitioned into a finite


number of equivalence classes such that one can reasonably assume,
but not be absolutely sure, that the test of a representative value of
each class is equivalent to a test of any other value
Two steps are required
 The equivalence classes are identified by taking each input
condition and partitioning it into valid and invalid classes
 Generate the test cases using the equivalence classes identified in
the previous step. This is performed by writing test cases covering
all the valid equivalence classes. Then a test case is written for each
invalid equivalence class so that no test contains more than one
invalid class. This is to ensure that no two invalid classes mask each
other

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit


02/06/2024 118
IV
Equivalence Class Testing

Most of the time, equivalence class testing defines classes of the input
domain. However, equivalence classes should also be defined for
output domain. Hence, we should design equivalence classes based on
input and output

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 119
Unit IV
Path Testing

This type of testing involves:


1. Generating a set of paths that will cover every branch in the
program.
2. Finding a set of test cases that will execute every path in the set of
program paths.
Step 1:
Generate Control flow graph of a program.
Step 2:
Draw a Decision to Decision path (DD-path) graph from the
control flow graph.
it is a directed graph. node are sequences of statements and edges represent
control flow between them.
DD path is used to find Independent path.
Independent path: it is used to ensure
1. Every statement in the program has been executed at least once.
2. Every branch has been exercised for true and false condition.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 120
Unit IV
Data Flow Testing

Data flow testing is another from of structural testing. It has nothing to


do with data flow diagrams.
i. Statements where variables receive values.
ii. Statements where these values are used or referenced.

As we know, variables are defined and referenced throughout the


program. We may have few define/ reference anomalies:

i. A variable is defined but not used/ referenced.


ii. A variable is used but never defined.
iii. A variable is defined twice before it is used.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 121
Unit IV
Data Flow Testing

The definitions refer to a program P that has a program graph G(P) and
a set of program variables V. The G(P) has a single entry node and a
single exit node. The set of all paths in P is PATHS(P)

Defining Node: Node n ϵ G(P) is a defining node of the variable v ϵ V,


written as DEF (v, n), if the value of the variable v is defined at the
statement fragment corresponding to node n

Usage Node: Node n ϵ G(P) is a usage node of the variable v ϵ V,


written as USE (v, n), if the value of the variable v is used at statement
fragment corresponding to node n. A usage node USE (v, n) is a
predicate use (denote as p) if statement n is a predicate statement
otherwise USE (v, n) is a computation use (denoted as c)

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 122
Unit IV
Data Flow Testing

Definition use: A definition use path with respect to a variable v


(denoted du-path) is a path in PATHS(P) such that, for some v ϵ V, there
are define and usage nodes DEF(v, m) and USE(v, n) such that m and n
are initial and final nodes of the path.
Definition clear : A definition clear path with respect to a variable v
(denoted dc-path) is a definition use path in PATHS(P) with initial and
final nodes DEF(v, m) and USE (v, n), such that no other node in the
path is a defining node of v.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 123
Unit IV
Mutation testing

• In this, software is first tested:


–Using an initial test suite designed using white-box
strategies we already discussed.

• After the initial testing is complete,


–Mutation testing is taken up.

• The idea behind mutation testing:


–Make a few arbitrary small changes to a program at a time.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 124
Unit IV
Mutation testing

Main Idea

• Insert faults into a program:


– Check whether the test suite is able to detect these.
– This either validates or invalidates the test suite.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 125
Unit IV
Mutation Testing Terminology

• Each time the program is changed:


–It is called a mutated program
–The change is called a mutant.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 126
Unit IV
Mutation Testing

• A mutated program:
–Tested against the full test suite of the program.
• If there exists at least one test case in the test suite for which:
–A mutant gives an incorrect result,
–Then the mutant is said to be dead.
• If a mutant remains alive ---even after all test cases have exhausted,
–The test suite is enhanced to kill the mutant.
• The process of generation and killing of mutants:
–Can be automated by predefining a set of primitive changes that
can be applied to the program.
Dr. Nidhi Sharma ACSE0603 Software Engineering
02/06/2024 127
Unit IV
Mutation Testing

Example primitive changes to a program:


–Deleting a statement
–Altering an arithmetic operator,
–Changing the value of a constant,
–Changing a data type, etc.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 128
Unit IV
Mutation Testing

• Deletion of a statement
• Boolean:
• Replacement of a statement with another
eg. == and >=, < and <=
• Replacement of boolean expressions with true or false eg. a || b
with true
• Replacement of arithmetic operator
eg. * and +, / and -
• Replacement of a variable (ensuring same scope/type)

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 129
Unit IV
Mutation testing

Disadvantage:
• it is computationally very expensive, due to a large number of
possible mutants can be generated.
• it is not suitable for manual testing. Mutation testing should be
used in conjunction of some testing tool which would run all the
test cases automatically. Version

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 130
Level Of Testing

There are 3 levels of testing:


i. Unit Testing
ii. Integration Testing
iii. System Testing

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 131
Unit Testing (CO4)

• It is also called module testing.


• Follows a white box testing(logic of program).
• Done by developer.
• It is the testing of different units (or modules) of a system in
isolation.
• steps are needed in order to be able to test the module:
– The procedures belonging to other modules that the module
under test calls.
– Nonlocal data structures that the module accesses.
– A procedure to call the functions of the module under test
with appropriate parameters.

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit


02/06/2024 132
IV
Stub and Driver

Stubs and drivers are designed to provide the complete environment


for a module.
Stub: it is a dummy procedure that has the same I/O parameters
as the given procedure but has a highly simplified behavior.
Driver : it contain the nonlocal data structures accessed by the
module under test, and would also have the code to call the
different functions of the module with appropriate parameter
values.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 133
Unit IV
Integration Testing (CO4)

The purpose of unit testing is to determine that each


independent module is correctly implemented. This gives little
chance to determine that the interface between modules is also
correct, and for this reason integration testing must be
performed. One specific target of integration testing is the
interface: whether parameters match on both sides as to type,
permissible ranges, meaning and utilization.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 134
Unit IV
Integration Testing

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 135
Unit IV
Bottom-Up Integration

• Only terminal modules (i.e., the modules that do not call other modules)
are tested in isolation
• Modules at higher level are tested using the previously tested lower level
modules
• Non-terminal modules are not tested in isolation
• Requires a module driver for each module to feed the test case input to the
interface of the module being tested
– However, stubs are not needed since we are starting with the terminal
modules and use already tested modules when testing modules in the
lower levels

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 136
Unit IV
Bottom-Up Integration

A B

C H

E F G I

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 137
Unit IV
Top-down Integration

• Only modules tested in isolation are the modules which are at the
highest level
• After a module is tested, the modules directly called by that
module are merged with the already tested module and the
combination is tested
• Requires stub modules to simulate the functions of the missing
modules that may be called
– However, drivers are not needed since we are starting with the
modules which is not used by any other module and use
already tested modules when testing modules in the higher
levels

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 138
Unit IV
Top-down Integration

A B

C
H

E F G I

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 139
Unit IV
Other Integration Approaches

• Sandwich Integration
– Compromise between bottom-up and top-down testing
– Simultaneously begin bottom-up and top-down testing
and meet at a predetermined point in the middle
• Big Bang Integration
– Every module is unit tested in isolation
– After all of the modules are tested they are all
integrated together at once and tested
– No driver or stub is needed
– However, in this approach, it may be hard to isolate the
bugs!

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 140
Unit IV
System Testing (CO4)

•Alpha Testing: Alpha testing refers to the system testing carried out
by the test team within the developing organization.

• Beta testing: Beta testing is the system testing performed by a


select group of friendly customers.

• Acceptance Testing: Acceptance testing is the system testing


performed by the customer to determine whether he should accept
the delivery of the system.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 141
Unit IV
System Testing

Performance testing : Performance testing is carried out to check


whether the system needs the nonfunctional requirements identified
in the SRS document. All performance tests can be considered as black-
box tests.
• Stress testing
• Volume testing
• Configuration testing
• Compatibility testing
• Regression testing
• Recovery testing
• Maintenance testing
• Documentation testing
• Usability testing

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 142
Unit IV
System Testing

Stress testing : Stress tests are black box tests which are designed to
impose a range of abnormal and even illegal input conditions so as
to stress the capabilities of the software. For example, suppose an
operating system is supposed to support 15 multi programmed jobs,
the system is stressed by attempting to run 15 or more jobs
simultaneously. A real-time system might be tested to determine the
effect of simultaneous arrival of several high-priority interrupts.

• Volume testing: It is especially important to check whether the


data structures (arrays, queues, stacks, etc.) have been designed to
successfully extraordinary situations. For example, a compiler might
be tested to check whether the symbol table overflows when a very
large program is compiled

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 143


System Testing

• Configuration testing: This is used to analyze system behavior in


various hardware and software configurations specified in the
requirements.

• Compatibility testing : This type of testing is required when the


system interfaces with other types of systems. Compatibility aims to
check whether the interface functions perform as required.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 144
Unit IV
System Testing

• Regression testing: This type of testing is required when the


system being tested is an upgradation of an already existing system
to fix some bugs or enhance functionality, performance, etc.

• Recovery testing : Recovery testing tests the response of the


system to the presence of faults, or loss of power, devices,
services, data, etc.

• Maintenance testing : This testing addresses the diagnostic


programs, and other procedures that are required to be developed
to help maintenance of the system. It is verified that the artifacts
exist and they perform properly.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 145
Unit IV
System Testing

• Documentation testing: It is checked that the required user


manual, maintenance manuals, and technical manuals exist and are
consistent.

• Usability testing: Usability testing concerns checking the user


interface to see if it meets all user requirements concerning the user
interface.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 146
Unit IV
Static Testing Strategies:

Static Testing is a type of a Software Testing method which is performed to check the
defects in software without actually executing the code of the software application.
Whereas in Dynamic Testing checks the code is executed to detect the defects.
Static testing is performed in early stage of development to avoid errors as it is easier to
find sources of failures and it can be fixed easily. The errors that can’t not be found using
Dynamic Testing, can be easily found by Static Testing.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 147


Static Testing Strategies:

Static testing techniques enhances the quality and efficiency of software


development. The Static testing technique can be done in two ways, which are
as follows:
• Review
• Static Analysis
 Review
It is a technique or a process implemented to find the possible bugs in the
application. We can easily identify and eliminate faults and defects in the
various supporting documents such as SRS [Software Requirements
Specifications] in the review process.
It is that where all the team members will understand about the project's
progress.
Reviews can be divided into four different parts, which are as follows:
• Informal reviews
• Walkthroughs
• Technical/peer review
• Inspections
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 148
Static Testing Strategies:

• Informal reviews
In informal review, the document designer place the contents in front of
viewers, and everyone gives their view; therefore, bugs are acknowledged in
the early stage.
• Walkthrough
Generally, the walkthrough review is used to performed by a skilled person
or expert to verify the bugs. Therefore, there might not be problem in the
development or testing phase.
• Peer review
In Peer review, we can check one another's documents to find and resolve
the bugs, which is generally done in a team.
• Inspection
In review, the inspection is essentially verifying the document by the higher
authority, for example, the verification of SRS [software requirement
specifications] document.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 149


Static Testing Strategies:
Static Analysis
• Static Testing technique is static analysis, which is used to contain the
assessment of the code quality, which is established by developers.
• Developers' developed code is analyzed with some tools for structural bugs,
which might cause the defects.
 The static analysis will also help us to identify the below errors:
• Dead code
• Unused variables
• Endless loops
• Incorrect syntax
• Variable with undefined value
 Static Analysis can be further classified into three parts
• Data Flow: In static analysis, the data flow is connected to the stream
processing.
• Control Flow: Generally, the control flow is used to specify how the
commands or instructions are implemented.
• Cyclomatic Complexity: It is the measurement of the program's
complexity, which is mostly linked to the number of independent paths in
the control flow
02/06/2024 graph
Dr. Nidhi of theACSE0603
Sharma program.Software Engineering Unit IV 150
Formal Technical Review(CO4)

Formal Technical Review(Code review)


• Perform on module.
• It is carried out after the module is successfully compiled and all
the syntax errors have been eliminated.
• It is extremely cost-effective strategies for reduction in coding errors
and to produce high quality code.
• Normally, two types of reviews are carried out on the code of a
module.
• 1 Code inspection
• 2 Code walk Through

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 151
Unit IV
Code Walk Through (CO4)

1. The main objectives of the it is to discover the algorithmic and


logical errors in the code.
2. It is an informal code analyses technique.
3. It is done after a module has been coded, successfully
compiled and all syntax errors eliminated.
4. A few members of the development team are given the code
few days before the walk through meeting to read and
understand code.
5. Each member selects some test cases and simulates execution
and tracing of the code by hand.
6. The members note down their findings to discuss these in a
walk through meeting where the coder of the module is
present.
7. After meeting several guidelines have evolved over the years
for making this useful analysis technique more effective.
Dr. Nidhi Sharma ACSE0603 Software Engineering
02/06/2024 152
Unit IV
Code Walk Through

Some of these guidelines are the following.


• The team performing code walk through should not be either too big
or too small.
• Discussion should focus on discovery of errors and not on how to fix
the discovered errors.
• In order to cooperation and to avoid the feeling among engineers that
they are being evaluated in the code walk through meeting, managers
should not attend the walk through meetings.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 153
Unit IV
Code inspection (CO4)

Code is examined for the presence of certain kinds of errors, in


contrast to the hand simulation of code execution done in code walk
through.
List of some classical programming errors which can be checked
during code inspection:
• Use of uninitialized variables.
• Jumps into loops.
• Non terminating loops.
• Incompatible assignments.
• Array indices out of bounds.
• Improper storage allocation and deallocation

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 154
Unit IV
Compliance with design and coding standards

Compliance with design and coding standards in software engineering is essential for
various reasons:
Maintainability: Following established design and coding standards ensures that the
codebase remains maintainable over time. It makes it easier for developers to understand,
update, and extend the code without introducing errors or unexpected behaviors.
Collaboration: Consistent coding standards facilitate collaboration among team
members. When everyone follows the same conventions, it becomes easier to review
each other's code, provide feedback, and work together seamlessly.
Quality: Adhering to design and coding standards helps maintain a high level of quality
in the software. Standards often include best practices for writing clean, efficient, and
bug-free code, leading to fewer defects and improved reliability.
Scalability: Standards enable scalability by providing a framework for organizing code
in a structured and predictable manner. This allows the software to grow and evolve
without becoming overly complex or difficult to manage.
Portability: Code that follows standards is generally more portable across different
platforms and environments. This ensures that the software can run reliably on various
operating systems, hardware configurations, and software dependencies.

Dr. Nidhi Sharma ACSE0603 Software Engineering


02/06/2024 155
Unit IV
Faculty Video Links, Youtube & NPTEL Video Links and
Online Courses Details

• https://nptel.ac.in/courses/106/105/106105182/
• https://www.youtube.com/watch?v=mGrajqMLenI&list=PLyqSpQzTE6
M-sBjDcT21Gpnj8grR2fDgc&index=16
• https://www.youtube.com/watch?v=biKUffL8cm4&list=PLyqSpQzTE6M
-sBjDcT21Gpnj8grR2fDgc&index=2
• https://www.youtube.com/watch?v=0kkUnL1mdUY&list=PLyqSpQzTE6
M-sBjDcT21Gpnj8grR2fDgc&index=4

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 156
Daily Quiz

1) Software testing is:


(a) The process of demonstrating that errors are not present
(b) The process of establishing confidence that a program does what it is supposed to do
(c) The process of executing a program to show it is working as per specifications
(d) The process of executing a program with the intent of finding errors
2) Software mistakes during coding are known as:
(a) failures (b) defects (c) bugs (d) errors
3) Functional testing is known as:
(a) Structural testing (b) Behavior testing (c) Regression testing (d) None
4) Regression testing is primarily related to:
(a) Functional testing (b) Data flow testing
(c) Development testing (d) Maintenance testing
5)Validation is
(a) Checking the product with respect to customer’s expectation
(b) Checking the product with respect to specifications
(c) Checking the product with respect to the constraints of the project
(d) All of the above

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 157
Daily Quiz
6) For a function of n variables, boundary value analysis yields:
(a) 4n+3 test cases (b) 4n+1 test cases
(c) n+4 test cases (d) None of the above
7 ) Beta testing is carried out by
(a) Users (b) Developers
(c) Testers (d) All of the above

8) Equivalence class partitioning is related to


(a) Structural testing (b) Black box testing
(c) Mutation testing (d) All of the above

9) Cause effect graphing techniques is one form of


(a) Maintenance testing (b) Structural testing
(c) Function testing (d) Regression testing

10) During validation


(a) Process is checked (b) Product is checked
(c) Developer’s performance is evaluated (d) The customer checks the product
Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV
02/06/2024 158
Weekly Assignment

1. What is software testing? Discuss the role of software testing


during software life cycle and why is it so difficult?
2. Why should we test? Who should do the testing?
3. What should we test? on this statement. Illustrate the
Comment importance of testing
4. Defined the following terms:
(i) fault (ii) failure
(iii) bug (iv) mistake
5. What is the difference between
(i) Alpha testing & beta testing
(ii) Development & regression testing
(iii) Functional & structural testing
6. Discuss the limitation of testing. Why do we say that complete testing is
impossible?
Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV
02/06/2024 159
Weekly Assignment

7. Why does software fail after it has passed from acceptance testing? Explain

8. What are various kinds of functional testing? Describe any one in detail

9. Explain the boundary value analysis testing techniques with the help of
an example
10. Discuss cause effect graphing technique with an example

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 160
MCQ

1 For a function of two variables, how many cases will be generated


by robustness testing?
(a) 9 (b) 13
(c) 25 (d) 42
2 For a function of n variables robustness testing of boundary value analysis
yields: (a) 4n+1 (b) 4n+3
(c) 6n+1 (d) None of the above
3 Regression testing is primarily related to:
(a) Functional testing (b) Data flow testing
(c) Development testing (d) Maintenance testing
4 A node with indegree=0 and out degree ≠ 0 is
(a) Source node
called (b) Destination node
(c) Transfer node (d) None of the above
5 A node with indegree ≠ 0 and out degree=0 is
(a) Source node
called (b) Predicate node
(c) Destination node (d) None of the above
Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV
02/06/2024 161
MCQ

6 A decision table has


(a) Four portions (b) Three portions
(c) Five portions (d) Two portions
7 Beta testing is carried out by
(a) Users (b) Developers
(c) Testers (d) All of the above
8 Equivalence class partitioning is related to
(a) Structural testing (b) Blackbox testing
(c) Mutation testing (d) All of the above
9 Cause effect graphing techniques is one form of
(a) Maintenance testing (b) Structural testing
(c) Function testing (d) Regression testing
10 During validation
(a) Process is checked (b) Product is checked
(c) Developer’s performance is evaluated (d) The customer checks the product

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 162
Glossary Questions

1. Formal testing with respect to user needs, a. acceptance testing


requirements, and business processes conducted to
determine whether or not a system satisfies the
acceptance criteria and to enable the user, customers or
other authorized entity to determine whether or not to
accept the system.
2. A step-by-step presentation by the author of a b. Walkthrough
document in order to gather information and to
establish a common understanding of its content.
3. Testing where the system is subjected to large volumes c. volume testing
of data. See also resource-utilization testing.
4. Artifacts produced during the test process required to d. Testware
plan, design, and execute tests, such as documentation,
scripts, inputs, expected results, set-up and clear-up
procedures, files, databases, environment, and any
additional software or utilities used in testing.
5. A set of several test cases for a component or system e. test suite
under test, where the post condition of one test is often
used as the precondition for the next one.

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 163


Old Question Papers

02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 164


Old Question Papers

02/06/2024 165
Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV
Old Question Papers

02/06/2024 166
Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV
Expected Questions for University Exam

1. Why does software fail after it has passed from acceptance


testing?
2. What are various kinds of functional testing? Describe any one in
detail.
3. Explain the boundary value analysis testing techniques with the
help of an example.
4. Describe the equivalence class testing method. Compare this with
boundary value analysis techniques.
5. Discuss cause effect graphing technique with an example

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 167
Recap of Unit

• Testing Objectives, UNIT Testing, Integration Testing, Acceptance


Testing,
• Regression Testing, Testing for functionality and Testing for
Performance,
• Top-Down and Bottom-Up Testing Strategies:
• Test Drivers and Test Stubs,
• Structural Testing (White Box Testing), Functional Testing (Black
Box Testing),
• Alpha and Beta Testing of Products.
• Static Testing Strategies: Formal Technical Reviews (Peer Reviews),
Walk Through,
• Code Inspection, Compliance with Design and Coding Standards

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 168
References

1. R. S. Pressman, Software Engineering: A Practitioners Approach,


McGraw Hill.
2. Rajib Mall, Fundamentals of Software Engineering, PHI
Publication.
3. K. K. Aggarwal and Yogesh Singh, Software Engineering, New Age
International Publishers.
4. Pankaj Jalote, Software Engineering, Wiley
5. Deepak Jain,” Software Engineering: Principles and Practices”,
Oxford University Press.
6. Munesh C. Trivedi, Software Engineering, Khanna Publishing
House
7. N.S. Gill, Software Engineering, Khanna Publishing House

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 169
Noida Institute of Engineering and Technology, Greater
Noida

Thank You

Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV


02/06/2024 170

You might also like