Professional Documents
Culture Documents
Unit 4 CN
Unit 4 CN
Introduction
Unit: 4
Software Engineering
Dr Nidhi Sharma
AIT0401
Assistant Professor
(B Tech IVth Sem) (CSDS)
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.
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
Failure
• Bug distribution:
Bug Source
– 60% spec/design, 40% implementation.
Spec and
Design
Code
• Review
• Testing
One way:
# Bugs
• 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.
–Whereas, the aim of validation is that the final product is error free.
• Simulation
• Unit testing
• Integration testing
Verification Validation
Are you building it right? Have you built the right thing?
4 Testing Levels
• Software tested at 4 levels:
–Unit testing
–Integration testing
–System testing
–Acceptance 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
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.
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.
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
•It would become difficult to determine which module has the error.
• Smoke test:
– System test performed daily or several times a week after every build.
62
• 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
Feasibility Study
Req. Analysis
Design
Testing by
developers
Coding
Testing by Tester
Review,
Simulation, Testing
etc.
Maintenance
• Test data:
– Inputs used to test the system
• 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…”
79
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
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
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.
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.
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.
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.
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
Failure
PROCEDURE
STUB UNDER TEST DRIVER
CALL
Access To Nonlocal
Variables
–Black-box approach
–Grey-box approach
13
• Test cases are designed using only functional specification of the software:
–Without any knowledge of the internal structure of the software.
Software
Input Output
14
18
System
Input Output
–Identify scenarios
–Examine output
• Few guidelines for determining the equivalence classes can be given…
•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
• First-level partitioning:
– Valid vs. Invalid test cases
Valid Invalid
Invalid
Valid
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 83
Equivalence Partitioning
Invalid
Valid
– The tester has reasons to believe that execution with certain values
may expose bugs:
1 100
• Programmers often commit mistakes in the:
54
57
02/06/2024 Dr. Nidhi Sharma ACSE0603 Software Engineering Unit IV 89
Boundary Value Testing: Code Example
• 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
• 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}.
• For a function that computes the square root of an integer in the range of 1
and 5000:
1
5000
4. - immediately below
maximum
5. - at maximum
boundary 64
65
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
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
1. Path Testing
2. Cyclomatic Complexity
3. Graph Matrices
4. Data Flow Testing
5. Mutation 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.
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.
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.
The following are the main approaches to designing black box test
cases.
a≤x≤b
c≤y≤d
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
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
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)
Main Idea
• 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
• 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)
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
• 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
A B
C H
E F G I
• 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
A B
C
H
E F G I
• 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!
•Alpha Testing: Alpha testing refers to the system testing carried out
by the test team within the developing organization.
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.
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.
• 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.
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.
• 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
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
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
Thank You