Collate Se Unit 4 Notes
Collate Se Unit 4 Notes
Software
Engineering
Notes
Unit 4
02
Syllabus
UNIT – IV
Software Testing:
Software process, Functional testing: Boundary value analysis,
Equivalence class testing, Decision table testing,
Cause effect graphing, Structural testing: Path testing, Data flow
and mutation testing, unit testing, integration and
system testing, Debugging, Testing Tools & Standards.
Software Maintenance:
Management of Maintenance, Maintenance Process, Maintenance
Models, Reverse Engineering, Software Reengineering,
Configuration Management, Documentation.
COLLATE
SOURCE - IPU
TESTING
Testing is the process of evaluating a system or its component(s) with the
concentrating to find whether it satisfies the specified requirements or not.
Software testing can be stated as the process of verifying and validating that a
software or application is bug free, meets the technical requirements as guided by
it’s design and development and meets the user requirements effectively and
efficiently with handling all the exceptional and boundary cases.
The process of software testing aims not only at finding faults in the existing
software but also at finding measures to improve the software in terms of efficiency,
accuracy and usability. It mainly aims at measuring specification, functionality and
performance of a software program or application.
WHO DOES TESTING?
It depends on the process and the associated stakeholders of the project(s). In the
IT industry, large companies have a team with responsibilities to evaluate the
developed software in context of the given requirements. Moreover, developers also
conduct testing which is called Unit Testing. In most cases, the following
professionals are involved in testing a system within their respective capacities −
Software Tester
Software Developer
Project Lead/Manager
End User
Different companies have different designations for people who test the software on
the basis of their experience and knowledge such as Software Tester, Software
Quality Assurance Engineer, QA Analyst, etc.
It is not possible to test the software at any time during its cycle. The next two
sections state when testing should be started and when to end it during the SDLC.
1. Verification: it refers to the set of tasks that ensure that software correctly
implements a specific function.
2. Validation: it refers to a different set of tasks that ensure that the software that has
been built is traceable to customer requirements.
The following table highlights the differences between verification and validation.
Verification Validation
Ensures that the software system Ensures that the functionalities meet the
meets all the functionality. intended behavior.
Verification takes place first and Validation occurs after verification and
includes the checking for mainly involves the checking of the
documentation, code, etc. overall product.
If someone makes an error or mistake in using the software, this may lead directly to a
problem – the software is used incorrectly and so does not behave as we expected. However,
people also design and build the software and they can make mistakes during the design and
build. These mistakes mean that there are flaws in the software itself. These are
called defects or sometimes bugs or faults.
Error: Error is a human action that produces an incorrect result. It is deviation from
actual and expected value. The mistakes made by programmer is known as an ‘Error’.
Bug: A Bug is the result of a coding Error or Fault in the program which causes the
program to behave in an unintended or unanticipated manner. It is an evidence of fault in the
program. Bugs arise from mistakes and errors, made by people, in either a program’s source
code or its design.
Failure: Failure is a deviation of the software from its intended purpose. It is the inability of a
system or a component to perform its required functions within specified performance
requirements. Failure occurs when fault executes.
UNIT TESTING
Unit testing is undertaken after a module has been coded and successfully
reviewed. Unit testing (or module testing) is the testing of different units (or
modules) of a system in isolation.
Modules are required to provide the necessary environment (which either call
or are called by the module under test) is usually not available until they too
have been unit tested, stubs and drivers are designed to provide the complete
environment for a module. The role of stub and driver modules is pictorially
shown in figure. A stub procedure is a dummy procedure that has the same
I/O parameters as the given procedure but has a highly simplified behavior.
For example, a stub procedure may produce the expected behavior using a
simple table lookup mechanism. A driver module 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.
Unit testing with the help of driver and stub modules
Example 1: For a software that computes the square root of an input integer
which can assume values in the range of 0 to 5000, there are three
equivalence classes: The set of negative integers, the set of integers in the
range of 0 and 5000, and the integers larger than 5000. Therefore, the test
cases must include representatives for each of the three equivalence classes
and a possible test set can be: {-5,500,6000}.
Example 2: Design the black-box test suite for the following program. The
program computes the intersection point of two straight lines and displays the
result. It reads two integer pairs (m1, c1) and (m2, c2) defining the two
straight lines of the form y=mx + c.
The equivalence classes are the following:
• Parallel lines (m1=m2, c1≠c2)
• Intersecting lines (m1≠m2)
• Coincident lines (m1=m2, c1=c2)
Now, selecting one representative value from each equivalence class, the test
suit (2, 2) (2, 5), (5, 5) (7, 7), (10, 10) (10, 10) are obtained.
Example: For a function that computes the square root of integer values in
the range of 0 and 5000, the test cases must include the following values: {0,
-1,5000,5001}.
WHITE BOX TESTING
One white-box testing strategy is said to be stronger than another strategy, if
all types of errors detected by the first testing strategy is also detected by the
second testing strategy, and the second testing strategy additionally detects
some more types of errors. When two testing strategies detect errors that are
different at least with respect to some types of errors, then they are called
complementary. The concepts of stronger and complementary testing are
schematically illustrated in figure.
End users, testers and developers. Normally done by testers and developers.
BLACK BOX TESTING WHITE BOX TESTING
THis can only be done by trial and error Data domains and internal boundaries can be
Username (T/F) F T F T
Password (T/F) F F T T
Output (E/H) E E E H
To determine the current problem so that right decision can be taken very
fast.
To narrate the connections of the system with the factors affecting a
particular process or effect.
To recognize the probable root causes, the cause for a exact effect, problem,
or outcome.
It finds out the areas where data is collected for additional study.
It motivates team contribution and uses the team data of the process.
Uses synchronize and easy to read format to diagram cause-and-effect
relationships.
Point out probable reasons of difference in a process.
It enhances facts of the procedure by helping everyone to learn more about
the factors at work and how they relate.
It assists us to decide the root reasons of a problem or quality using a
structured approach.
Fourth: Convert decision table rules to test cases. Each column of the decision
table represents a test case
The “Print message” is software that read two characters and, depending on their
values, messages must be printed.
The first character must be an “A” or a “B”.
The second character must be a digit.
If the first character is an “A” or “B” and the second character is a digit, the
file must be updated.
If the first character is incorrect (not an “A” or “B”), the message X must be
printed.
If the second character is incorrect (not a digit), the message Y must be
printed.
Solution:
The causes for this situation are:
C1 – First character is A
C2 – First character is B
C3 – the Second character is a digit
LET’S START!!
Key – Always go from effect to cause (left to right). That means, to get effect “E”,
what causes should be true.
The circle in the middle is just an interpretation of the middle point to make the
graph less messy.
There is a third condition where C1 and C2 are mutually exclusive. So the final
graph for effect E1 to be true is shown below:
Let’s move to Effect E2:
E2 states to print message “X”. Message X will be printed when the First character
is neither A nor B.
Which means Effect E2 will hold true when either C1 OR C2 is invalid. So the graph
for Effect E2 is shown as (In blue line)
Now let’s move to draw the Decision table based on the above graph.
Key is the same. Go from bottom to top which means traverse from effect to cause.
Start with Effect E1. For E1 to be true, the condition is (C1 C2) C3.
Here we are representing True as 1 and False as 0
So it’s done. Let’s complete the graph by adding 0 in the blank column and
including the test case identifier.
WRITING TEST CASES FROM THE DECISION TABLE
I am writing a sample test case for test case 1 (TC1) and Test Case 2 (TC2).
(A test case contains many other attributes like preconditions, test data, severity,
priority, build, version, release, environment etc. I assume all these attributes to
be included when you write the test cases in actual situation)
Conclusion
Summarizing the steps once again:
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.
PATH TESTING
Path Testing is a structural testing method based on the source code or algorithm
and NOT based on the specifications. It can be applied at different levels of
granularity.
PATH TESTING ASSUMPTIONS:
There are no defects that exist in the system other than those that affect
control flow
PATH TESTING TECHNIQUES:
Control Flow Graph (CFG) - The Program is converted into Flow graphs by
representing the code into nodes, regions and edges.
Decision to Decision path (D-D) - The CFG can be broken into various
Decision to Decision paths and then collapsed into individual nodes.
MUTATION TESTING
Mutation testing is a structural testing technique, which uses the structure of the
code to guide the testing process. On a very high level, it is the process of rewriting
the source code in small ways in order to remove the redundancies in the source
code
These ambiguities might cause failures in the software if not fixed and can easily
pass through testing phase undetected.
MUTATION TESTING BENEFITS:
Following benefits are experienced, if mutation testing is adopted:
Tools such as Insure++ help us to find defects in the code using the state-of-
the-art.
Debugging and Maintaining the product would be more easier than ever.
Data Coupling: If the dependency between the modules is based on the fact that
they communicate by passing only data, then the modules are said to be data
coupled. In data coupling, the components are independent to each other and
communicating through data. Module communications don’t contain tramp data.
Example-customer billing system.
Stamp Coupling In stamp coupling, the complete data structure is passed from one
module to another module. Therefore, it involves tramp data. It may be necessary
due to efficiency factors- this choice made by the insightful designer, not a lazy
programmer.
Common Coupling: The modules have shared data such as global data
structures.The changes in global data mean tracing back to all modules which access
that data to evaluate the effect of the change. So it has got disadvantages like
difficulty in reusing modules, reduced ability to control data accesses and reduced
maintainability.
Content Coupling: In a content coupling, one module can modify the data of
another module or control flow is passed from one module to the other module. This
is the worst form of coupling and should be avoided.
COHESION
Cohesion is a measure of the degree to which the elements of the module are
functionally related. It is the degree to which all elements directed towards
performing a single task are contained in the component. Basically, cohesion is the
internal glue that keeps the module together. A good software design will have high
cohesion.
TYPES OF COHESION:
Temporal Cohesion: The elements are related by their timing involved. A module
connected with temporal cohesion all the tasks must be executed in the same time-
span. This cohesion contains the code for initializing all the parts of the system. Lots
of different activities occur, all at init time.
Logical Cohesion: The elements are logically related and not functionally. Ex- A
component reads inputs from tape, disk, and network. All the code for these
functions is in the same component. Operations are related, but the functions are
significantly different.
SOFTWARE MAINTENANCE
Software maintenance has a very poor image in industry. Therefore, an organization often cannot
employ bright engineers to carry out maintenance work. Even though maintenance suffers from a
poor image, the work involved is often more challenging than development work. During
Another problem associated with maintenance work is that the majority of software products
needing maintenance are legacy products.
The first stage of reverse engineering usually focuses on carrying out cosmetic changes to the
code to improve its readability, structure, and understandability, without changing of its
functionalities. A process model for reverse engineering has been shown in fig. 24.1. A program
can be reformatted using any of the several available prettyprinter programs which layout the
program neatly. Many legacy software products with complex control structure and unthoughtful
variable names are difficult to comprehend. Assigning meaningful variable names is important
because meaningful variable names are the most helpful thing in code documentation. All
variables, data structures, and functions should be assigned meaningful names wherever possible.
Complex nested conditionals in the program can be replaced by simpler conditional statements
or whenever appropriate by case statements.
The activities involved in a software maintenance project are not unique and depend on several
factors such as:
• the extent of modification to the product required
When the changes needed to a software product are minor and straightforward, the code can be
directly modified and the changes appropriately reflected in all the documents. But more
elaborate activities are required when the required changes are not so trivial. Usually, for
complex maintenance projects for legacy systems, the software process can be represented by a
reverse engineering cycle followed by a forward engineering cycle with an emphasis on as much
reuse as possible from the existing code and other documents.
Two broad categories of process models for software maintenance can be proposed. The first
model is preferred for projects involving small reworks where the code is changed directly and
the changes are reflected in the relevant documents later. This maintenance process is graphically
presented in fig. 25.1. In this approach, the project starts by gathering the requirements for
changes. The requirements are next analyzed to formulate the strategies to be adopted for code
change. At this stage, the association of at least a few members of the original development team
goes a long way in reducing the cycle team, especially for projects involving unstructured and
inadequately documented code. The availability of a working old system to the maintenance
engineers at the maintenance site greatly facilitates the task of the maintenance team as they get a
good insight into the working of the old system and also can compare the working of their
modified system with the old system. Also, debugging of the reengineered system becomes
easier as the program traces of both the systems can be compared to localize the bugs.
where, KLOCadded is the total kilo lines of source code added during maintenance.
KLOCdeleted is the total kilo lines of source code deleted during maintenance.
Thus, the code that is changed, should be counted in both the code added and the code deleted.
The annual change traffic (ACT) is multiplied with the total development cost to arrive at the
maintenance cost:
maintenance cost = ACT × development cost.
Most maintenance cost estimation models, however, yield only approximate results because they
do not take into account several factors such as experience level of the engineers, and familiarity
of the engineers with the product, hardware requirements, software complexity, etc.
Content Feedback
Feel free to submit your issues, suggestions and ratings
regarding this course content
Click Here
MSIT
Semester 3 CSE IT ECE
Semester 5 CSE IT
MAIT
Semester 3 CSE IT ECE
Semester 5 CSE IT
COLLATE
04
ADGITM (NIEC)
Semester 3 CSE IT ECE
Semester 5 CSE IT
GTBIT
Semester 3 CSE IT ECE
Semester 5 CSE IT
BVP
Semester 5 CSE IT
BPIT
CSE IT ECE
Semester 3
Semester 5 CSE IT
HMR
CSE IT ECE
Semester 3
Semester 5 CSE IT
COLLATE