You are on page 1of 24

iilii ii ii liiliiE

6-2 Software Coding end Testing 6-3 Software Coding and Testing
Sofnware Engineering Sotwa Engineening
and Coding Guidelines
6.1 Coding Standard GTU: Summer-2016, 2018,
For example
we get a system design which can be
larks while(condition)
whilelcondition)
After detailed system design
implementation model.
The goal coding is to implement the design in the nsíormed
best
into if condition
then
statement
Removing of
f condition then statement
very deeply. The codinPOble
statement f condition hen statemer
testing and maintenance condition then Nesting
manner. Coding affects both
of getting the job of
coding should t
programmer
else if
condition then statement f conditon then statement
done in such a manner that the instead simplified the else if
task of testing and maintenance phase should get simplified.
Various objectives of coding are Fig. 6.1.1
1. Programs developed in coding should be readable. of nesting the code becomes more readable but stil the
Note that after removing
2 They should execute efficiently. can be achieved.
same output
amount of
3. The program should utilize less memory 5. User
defined data types
4. The programs should not be lengthy. allow the user to use defined data types as the
Modern programming languages
If the objectives are clearly specified before the programmers then while coding the Use of user defined data types enhances the readability of the code
enumerated types.
try to achieve the specified objectives. To achieve these objectives some programmine In C we can define the name of the days using enumerated datatype
For example :
principles mustbe followed.
enum Day
6.1.1 Coding Guideline
Sunday
There Monday:
are some commonly used programming practices that help in avoiding the Tuesday
common errors. These are enlisted below Wednesday;
Thursday
1. Control construct
Friday:
The and Saturday
single entry single exit constructs need to be used. The standard control
}workday:
constructs must be used instead of wide variety of controls.
using
enum Day Today=Friday;
2. Use of gotos
6. Module size
large size of the
The goto statements make the module but the
program unstructured and it also imposes overhead about the size of the
There is no standard rule
on
compilation process. Hence avoid use of goto statements as far as possible and another cohesive.
alternative must be thought of. module will not be functionally
3. Information hiding 7. Side effects then it will
the code is changed randomly
Avoid obscure side
effects. If some part of to the function is
Information hiding
should be of parameters passed
functions to the data struchures must be
supported
as far as In that case possible. only access example if number
side effect. For hunction.
made visible and the
cause some
the purpose of that
information present in difficult to understand
must be hidden. changed then it will be
names for specific purpose
4. Nesting 8. Use of Meaningful Variable tor mulbpie purposes.
variable name in temporary loops b e c o m e s easy
Nesting means
defining one structure inside
another.
Never make use of same
n a m e so
that the program
becomes hard If the nesting is too deep then be given some descriptive
to understand the code. Hence as far a c h variable must
the code. as
possible -
avoid deep nesting to understand.
An up thrust
for knowiedge
TECHNICAL PUBLICATIONS
PUBLICATIONS -
An up thrust for
knowledge
TECHNICAL
Sotwere Engineering 6-4 6-5
Software Coding and
soheareEngineoring
Software Coding and
Testing Tasting
9. Well Documentation 4 Statements
The code must be well documented with the help of comment statement
me
There a r e s o m e
guidelines about the declaration and exerutable statements
ents at
appropriate places Declare some related varnables on same line and unrelated variables on
line. another
6.1.2 Coding Standards Class variable should never be declared public.
Any good software development approach suggests to adhere to some well-defn. Make use of only loop control within the for loop
standards or rules for coding. These rules are called coding standards. efined
Avoid make use of break and continue
statements in the loop.
1. Naming Conventions
Avoid complex condiional expressions. Make use of temporary variables
instead.
Following are some
commonly used naming conventions in the coding
Package name and variable names should be in lower case Avoid the use of do..while statement.
Variable names must not begin with numbers.
Advantages of Coding Standards
The type name should be noun and it should start with capital letter.
1. Coding standard brings unitorm appearance in system implementation
Constants must be in upper case (For example Pl, SIZE)
2. The code becomes readable and hence can be understood easily
Method name must be given in lower case.
3. The coding standard helps in adopting good programming practices
oThe variables with large scope must have long name. For
example
count_total, sum, Variables with short scope must have short name.
For example Review Question
ij
The prefix is must be used for Boolean
type of variables. For
example isEmpty or
1. Explain the various coding standad. GTO Siummer-2016 2018 Matkr 7
isFull.
2. Files 6.2 Code Review GTU Sumer 2018 2019 Mark
Reader must get an idea about the purpose of the file The main goal of code inspection is to find out the detect defects in the coding
by its name. In some
programming language like Java -
An inspection is a review of a code by a group of peers following a clearly
The file extension must be defined process.
java.
oThe name of the file and the class defined in the the of the code by finding the defects
file must have the same name
Code inspection technique improve quality
oLine length in the file
must be limited to 80 characters. Following are some characteristics of code inspection process
1. The inspection must be conducted by the technical people for technical people.
3. Commenting/Layout
have definite role
2. It is a structured process in which every participant
Comments are non executable
part of the code. But it is very and not to solve them.
enhances the readability of the code. The important because it . The focus of code inspection is to identify the problems
the program. purpose of the code is to explain the logic of for further improvement.
The review data is recorded and monitored
4 The author of the team is
o
Single line comments must be given by // n e code inspection is by a team of reviewer.
performed
For the names of the variables moderator. is done in a
comments must be that the review
A black of comment given. h e moderator has the overall responsibility
to ensure
must be followed.
enclosed within /* and */. the review process are
PToper manner and all steps in planning
out in different phases such as
he code inspection is carried rework and followup.
review meeting
Preparation and overview, group
TECHNICAL PUBLICATIONS -
An up thrust for
knowledge PUBLICATIONS
An up thrust for knowlecgo
TECHNICAL
Sotware Engineering
6-6 Software Cod g and Testingo
Sofwere Engineering 6-7
oftware Coding and
Testing
Planning for
Review eally, the self eview should be done in
6.2.1 ne
contimuous time span. The
for code review. vecommended time 19 less than two hours.
The objective planning is to prepare
of
that the code is ready for inspection.
.This process ends
when all the reviewers
The moderator ensures prepare their own self review
.The moderator checks the entry criteria for the coding. The entry log,
analysiscriteria for Meeting
and the static Review
coding is that the code is compiled properly static anal tools 623 Group
applied. ATe
The basic purpose of group review
The review team also gets formed in this phase. meeting is to prepare a final defect list based
on the defected
enlisted in the self review
log of all the reviewers. There are
Then the code is distributed to the review team for reviewing, Th ances that new important defects might get discovered
documents, relevant checklists and standards are also provided to design The main outputs of this phase are the
during the meeting.
defect log and the defect
members. With the help of these documents the correctness of coda team summary report.
de can be
ensured. The moderator examines the effort and defect data
in the self
review logs to
conirm that sufficient time and attention has gone into the
6.2.2 Self Review preparation. When
preparation is not adequate, the
group review is deferred until all
I n overview and preparation phase, the code is reviewed by the
fully prepared.
participants are
reviewers
.The moderator may arrange an opening meeting. In this
meeting the author ma .If everything is ready then the meeting is held.
provide a brief overview of the product and any special areas that need to tayh is the
looked at carefully. But the meeting is optional and can be omitted. The moderator in-charge of this meeting
.The main task of this .The meeting is conducted as follows -
phase is that each reviewer has to do self review of the
code. The team member called reader goes through work product line by line. At any line
A reviewer goes through the entire code and logs all the the reviewer may raise some issues or can find new issues while listening to other
in the potential defects he finds reviews. The discussion takes place on these issues. If the issue is a defect then
self-preparation log.
The reviewers also record the time moderator accepts it or otherwise explains why that issue is not a defect.
they spent in the self-review.
.Relevant checklists, guidelines, and standards After the discussion the agreement is reached and a team member called scribe
may be used while reviewing.
.The records all the identified defects in the defect log. At the end of the meeting, the seribe
sample self review log is as shown below
reads out the defects recorded in the defect log for a final review by the team members
Projoct Name: Note that only defects are identified and not the sohution. The final defect log is
Code For: prepared which is the official record of the defects identified in the inspection and may
ID: also be used to track the defects.
Reviewer Name: For analysing the effectiveness of the review the information is summarised and a
Effort Spent(in Hrs): summary report is prepared. The summary report describes the work product, the total
Defect List effort spent, different review process activities, total number of defects found for each
category and size.
Name of defect ** **. *ik*******
Description Location Status The sample summary report is as shown below
(minor, major, critical)
Project Name XYZ
Work Product Code
Name AAA
Size of the product 30 pages
TECHNICAL PUBLICATIONS -
An up thrust for An up thrust for knowledge
knowledge TECHNICAL PUBLICATIONS -
6- 8 Software
Soware Engineering Coding and Testing S o f w a r eE n g i n e e r i n g

9
ftware Coding and Te
Review Team R1,R2,R3,R4,R5 Types o f Documents
of software docum
Effort are two types
There
Preparation 10 hours dternal Documentation: The internal documentation is
part of source code. a
Group Review Meeting 5 hours Inserth

of meaningful
comment statements at
appropriate place in the code, use
o f m e a nin f u l module name and variable
oful
ing
name, use of
Total Effort 15 hours appropriate data types, use
are the techniques of internal documentation.
of e n u m e r a t types,
Defects 2.External Documentation: External documentation can be done by creating various
**
Number of Minor defects
such as
orting documents su SRS, Design Document, Test
10
plan and so on.
se documents are normally created
during the software development life cycle
Number of Major defects
activities.
* ********i*sa
Number of Critical defects 2
eistency is the most important and desired feature of software
C documentation.
Total Number of defects 17
Introduction to Software Testing
Review Status Accepted
64
Definition : Software testing is a critical element of softrware quality assuranc
Recommendation for Next Phase and
epresents the ultimate review of specification, design and coding.
Commenis
*****
The purpose of software testing is to ensure whether the software functions appear to
be working according to specifications and performance requirements.
Review Question
64.1 Testing Objectives
1. Explain the process of code review. GTU:Summer-2018, Marks 4; Summer-2019,
Marks 3 According to Glen Myers the testing objectives are
6.3 Software Documentation 1. Testing is a process of executing a program with the intend of finding an error.
Various kinds of software documents need to 2. A good test case is one that has high probability of finding an undiscovered error.
be
development process. The software document includes sourcedeveloped during software
code, executable files, user 3. A successful test is one that uncovers an as-yet undiscovered error.
manual, Software Requirements
installation manual and so on. Specification(SRS), Design document, test document, The major testing objective is to design tests that systematically uncover types of
errors with minimum time and effort.
Purpose
Good documents are
very useful and serve following
6.4.2 Testing Principles
purpose the
1. Documents enhance the Every software engineer must apply following testing principles while performing
software product.
readability, understandability and maintainability of software testing
2. .All tests should be traceable to customer requirements.
They reduce the effort and time
3.
required for maintenance. 2. Tests should be planned long before testing begins.
They are useful in exploring the
system effectively. testing 80 % of al errors
4. They are used to keep track of the 3.The Pareto principle can be applied to software all program modules.
progress of the project. uncovered during testing will likely be traceable to 20 % of
5. Good documents
also help in
overcoming the toward testing "in the large".
Newcomer lesting should begin "in the small" and progress
quickly grasp the new manpower turnover
easily problem
can and
project. 5. Exhaustive
testing is not possible. third party
conducted by an independent
TECHNICAL PUBLICATIONS -
An up thrust for
O.1o be most testing should be
effective,
knowiedge
TECHNICAL PUBLICATIONS
An up thrust for knowtedge
5--11
SofwaraENgIneenng
Software Coding and Testing
Softwere Engineering 6 10
Software Coding and
Testing
ing
6.4.3 Why Testing Is Important ? Testing
Software
strategie development stages
Generally, testing is a process that requires more efforts than any other
V
engineering activity. ware System
testing System engineering
Testing is a set of activities that can be planned in advance and cond.
systematically Validation
Requirements
If it is conducted haphazardly, then time will be wasted and testing
only more e
worse errors may get introduced.
Integration
This may lead to have many undetected errors in the system
being develoned
testing Design
Hence performing testing by adopting systematic strategies is very much Unit
in during development of software.
essential testing Code
Review Question
1. What is importance of testing practices ? What are the principles of testing practices ?
6.5 Testing Strategies
GTU Summer-2012, 2016, 2018, 2019, Winter-2019, Marks 7
We begin by 'testing-in-the-small' and move toward 'testing-in-the-large'.
Various testing strategies for conventional software are
1. Unit testing Fig.6.5.1 Testing strategy
2 Integration testing
3. Validation testing 6.5.1 Unit Testing
to ensure their
are tested independentdy
4 System testing I n unit testing the individual components
1. Unit testing In this type of testing techniques are applied to detect the errors quality the errors in design and implementation.
from each software component individually. The focus is to uncover
descnbed as below.
unit test are
conducted during the out of the
2. It focuses on issues associated with verification and program T h e various tests
that are flow in and
Integration testing -
tested for proper
information
interfaces are
construction as components begin interacting with one another. 1. Module
maintained
program. is
3.Validation testing It provides assurance that the software validation criteia
Local data are
examined to ensure
that integrity
operates properly
at
(established during requirements analysis) meets all functional, behavioural and 2.
to ensure that the module
are
tested
performance requirements. 3. Boundary
conditions
o r restrict
processing.
in
established to limit that all
statements
boundaries
4. System testing - In system testing all system elements forming the system is tested
are tested for ensuring
(independent) paths
as a whole. All the basis only once.
4 module have
been executed
the tested.
should be
5. All error handling paths
A n up
thnust for knowdedg
PUBLICATIONS
TECHNICAL
TECHNICAL PUBLICATIONS An up thust for knowledge
6-13 Software Coding
Sofware
EDgineening
and Testing
Software Engineening 6 - 12
Software Coding and
Testing testing is to uncover
of integration
Things to be tested The focus
Design and
construction
ofsoftware architecture
Source program
Integrated functions or operations at subsystem level.
Interfaces Interfaces
and interactions between them.
Module Local data
to be structuresS Generating Resource integration
and/or environment integration.
/arious tested Boundary condition be carried out using two approaches.
modules
Independent path The integration testing can
in program integration
Error handling paths 1. The
non-incremental
Test 2. Incremental integration
cases
Integration testing approach
Fig. 6.5.2 Unit testing
6. Drivers and stub software need to be developed to test incomplete software
The "driver" is a program that accepts the test data and prints the relevant
results. And the "stub" is a subprogram that uses the module interfaces and
performs the minimal data manipulation if required. This is illustrated by
following Fig 6.5.3. Incremental integraton
Non-incremental integration
Top down testing
Big bang Bottom up integration
Driver Interface
Local data structures
Regression testing
Boundary conditions
Independent paths Smoke testing
Module Eror handling paths
Results
approach
6.5.4 Itegration testing
Fig.
approach. Al
Stub Stub by the "big bang"
Test non-incremental integration is given is tested as
a whole.
The entire program
cases advance. The Correction is
combined in whole.
components are tested as a
results. A set
of e r r o r s is the entire
the size of
Fig. 6.5.3 Unit testing envlronment And chaos usually complicated by
of c a u s e s is
continues
because isolation This process
dificult new ones
appear.
corrected
7. The unit testing is simplified when a component with high cohesion (with one these errors are
program. Once
function) is designed. In such a design the number of test cases are less and
one can easily predict or uncover errors.
infinitely. This approach is simple.
Advantage of big-bang:
to debug.
1. It is hard testing
6.5.2 Integration Testing Disadvantages
easy
to isolate
errors
while
results
2. It is not
validate test
A group of dependent components it is not easy to
tested together
their integration unit.
are to ensure their quality of 3. In this
approach
it is impossible
to
performing
testing,
4. After
The objective is to take unit tested
components and build a program structure that form an
integrated system.
has been dictated bysoftware design. thrust for knowedge
An up
PUBLICATIONS
TECHNICAL
TECHNICAL PUBLICATIONS An up thust
for knowledge
Software Engineening 6-114 6-15
ftware Coding and
Sotware Engineering Software Coding and
Testing
Testing
A n incremental construction
strategy includes Adriver program 1S written to cO-ordinate test case input and output.
Top down integration
whole cluster is tested.
Bottom up integration 3. The
Regression testing are removed and clusters are combined moving upward in the program
4. Drivers
Smoke testing structure.
6321 Top Down Integration Testing For example
.Top down testing is an incremental approach in which modules M1
moving down through the control structure.
are
integrated byh
.Modules subordinate to the main control module are
in either a
depth first breadth first manner.
incorporated into the svsterm
or
yste m
Integration process can be performed using following
1. The main control module is
steps.
used as a test driver and the
for all modules stubs are substituted
directly subordinate to the main control module.
2. Subordinate stubs
are
replaced one
depth first or breadth first method.
at a time with actual modules
using either
3. Tests are conducted as each
module is integrated.
4 On
completion of each set of tests, another stub is
module. replaced with the real
5.
Regression testing is conducted to
prevent the introduction
Cluster 1
of new errors.
For example
In top down
integration if the depth first
approach is adopted then will start we
M1 Cluster 2
integration from module Mi then we will Fig. 6.5.6 Bottom up integration testing9
integrate M2 then M3, M4, M5, M6 and
M7. then First are collected together to form cluster
1 and cluster 2 Then each
components
subordinate the driver module.
If breadth first M2 cluster is testedusing a driver program. The clusters
we will
approach is adopted then Atter the driver is removed and clusters are directly interfaced to the modules.
testing
integrate module M1 first then M2,
M6. Then we will
M5 and integrate module M3, M4, 6.5.2.3 Regression Testng
finally M7. to other modules by
M5 Regression testing is used to check for defects propagated
6.5.2.2 Bottom Up Integration Testing changes made to existing program.
Thus regression testing is used to reduce the
In bottom Fig. 6.5.5 Program structure side effects of the changes.
up integration the modules at involved in regression testing
integration the -
is done by lowest levels are three different classes of test
cases
moving upward through control structure.
the integrated
at first, then There are
test is used to exercise all software
The bottom Representative sample of existing
cases
up integration process can be carried functions.
1. Low-level modules out
using following steps. likely to be affected by the
subfunction.
are
combined into
clusters that Additional test cases focusing software functions
perform a
specific software change.
TECHNICAL Tests that focus on the changed software components.
PUBLICATIONS An up thrust for
cases
knowledge An up thrust for knowfedge
TECHNICAL PUBLICA TIONS
SoftwareEngineering 6-1/ Sofmware Coding and Testing
Softwere Engineering 6- 16
Software Coding and
Testin
sting ,The requirement specifications are derived and the deficiency ist is created. The
After product had been deployed, regression testing would be
after a change has been made to the product an error that can be
necessaru
because deficiencies then can be resolved by establishing the proper communication
discouor with the customer.
and
it should be corrected. Similarly for deployed product addition of
re
may
new fea ,Finally in validation testing a review is taken to ensure that all the elements of
be requested and implemented. For that reason regression
testing is essential configuration are developed as per requirements. This review is called
software
6.5.24 Smoke Testing configuration review or audit.
.The smoke testing is a kind of integration testing technique used 6531 Acceptance Testing
for time
projects wherein the project needs to be assessed on frequent basis. cal
is kind of testing conducted to ensure that the software
The acceptance testing
a
Following activities need to be carried out in smoke testing in the user work envirorment.
1. Software
works correctly
components already translated into code are integrated into a "build be conducted period of weeks or months.
The acceptance testing
can over a
The "build" can be data files, libraries, reusable
modules or program
components. ram The types of acceptance testing are
in which the of complete
2 A series of tests are 1.Alpha test The alpha testing is a testing version
desigmed to expose errors from build so that the "buila This testing
performs its functioning correctly. software is tested by the customer under the supervision of developer.
is performed at developer's site. The
software is used in natural setting in presence
3. The "build" is integrated with the other builds and the entire
tested daily.
product is smoke of developer. This test is conducted in controlled
environment.
The beta testing is a testing in which the version of software is tested by
2. Beta test
Smoke testing benefits performed at
the customer without the developer being present. This testing is
it is not
customer's site. As there is no presence of developer during
1. Integration risk is minimized. testing,
and report them to
2. The quality of the end controlled by developer. The end user records the problems
product is improved. then makes appropriate modification.
3. Error diagnosis and correction are developer. The developer
simplified.
4. Assessment of is Difference between Alpha and Beta Testing
progress easy.
Beta testing8
6.5.3 Validation Testing Alpha testing
austomer without
or by a This testing is done by the
The integrated software is tested This testing is done by a developer interterence of developer and
is done at
based on
requirements to ensure that the desired of developer any
product is obtained. Customer under the supervision customer's place.
n company's premises. tested under this
In is
validation testing the main focus is to uncover tested using The complete product
as free
Sometime full product is
not
testing. Such product usually given
errors in is
functionalities are
System input/output and only core
alpha testing trial version.
tested.
System functions and information data
System interfaces with external
parts 6.5.4 System Testing
- User interfaces the computer based system
conducted to fully
series of tests
The system test is a
System behaviour and performance Various types of system
tests are
.Software validation can be
performed through a series of black box tests. 1. Recovery testing
.
After performing the validation
tests there exists two 2. Security testing
1. The function or conditions.
and are accepted.
performance characteristics are according 3. Stress testing
to the
specifications 4. Performance testing
for knowiedge
thrust
An up
TECHNICAL PUBLICATIONS
TECHNICAL
PUBLICATIONS- An up thrust for
knowledge
6- 18 Software Coding and -19
Sofwere Engineenng Sofwere Engineeringg
Sotware Coding and Testin
Testing
The main focus of such testing is to test
hig sVstems (e.g banking systems) involving many users
connecting to servers
System functions and performance. (eg using internet) pertormance testing is very difficult
System reliability and recoverability (recovery test). Beta testing is useful tor performance testing
System installation (installation test).
.Systembehaviour in the special conditions (stress test). Review Questions
System user operations (acceptance test/alpha test).
1 Explain testing strategy for conventional softrware architecture. Drao the spiral diagram showing
Hardware and software integration and collaboration. testing strategies with phases of softroare development. GTU Summer-2012. Marks 7
Integration of external software and the system. 2. What are the different levles of testing? Exrplain amy one with suitable erample
6.5.4.1 Recovery Testing GTU Summer-2016 Marks 7
is intended to check the 3. Explain integration testing. GTU Summer-2018. 2019. Marks 7
Recovery testing system's ability to recover from failures
I n this 4. What are the different testing strategies ? Explain amy ome with suitable ezample
type of testing the software is forced to fail and then it is verified
whether
the system recovers properly or not. GTU Winter-2019, Marks 7
5. Compare and contrast alpha and beta testing. GTU Summer-2018, Marks 3
For automated recovery then reinitialization, checkpoint mechanisms, data 6. What are the different levels of testing ? Briefiy discuss the goal of each evel.
recovery and restart are verified.
GTU: Summer-2018. Marks 3
6.5.4.2 Security Testing
Security testing verifies that system protection mechanism prevent
6.6 Testing Conventional Applications
penetration or data alteration. improper
I t also verifies that
There are two general approaches for the software testing
protection mechanisms built into the
system prevent intrusion
such as unauthorized internal or external access 1. Black box testing
or willful damage.
The black box testing is used to demonstrate that the software functions are
System design goal is to make the penetration
attempt more costly than the value
of the information that will be obtained. operational. As the name suggests in black box testing it is
tested whether the input is
accepted properly and output is conrectly produced.
6.5.4.3 Stress Testing
The major focus of black box testing is on functions, operations, external interfaces,
Determines breakpoint of a system to establish maximum service level. external data and information.
I n stress
testing the system is executed in a manner that demands
abnormal quantity, frequency or volume. resources in 2. Whlte box testing
this testing the
A variation of stress In white box testing the procedural
details are closely examined. n
testing is a technique called that they operate according to specifications
.The sensitive testing is a sensitivity testing nternals of software are tested to make sure
structures, logic paths,
testing in which it is tried to uncover data from testing is on internal
white box
class of valid data that may cause a
large and
designs. Thus major focus of loops, etc.
structures, conditions,
instability or improper processing. control flows, data flows, internal data
6.54.4 Performance Testing Marks 7
6.7 White Box Testing GTU: Winter-2017, 2018, Summer-2012, 2019,
.
Performance testing evaluates the run time
real time software. performance of the software, especialuy
In 6.7.1 Basis Path Testing
performance testing resource utilization such basis set of execuhon path is tested. This
time, memory usage as CPU load, this method the procedural design
using
can be
measured. throughput, response In
will be tested at least once.
sis set that every execution path
ensures
TECHNICAL PUBLICATIONS -
An up thrust for An up thrust fose
knowledge TECHNICAL PUBLICATIONS
Software Engineering 6-20 Software Coding
and 21
Testing
SofwareEngineering
Sofnware Coding and Testing
6.7.1.1 Flow Graph Notation
Path testing is a structural testing strategy. This method is intended to amole Following program is for searching a number using binary search
exere exercise every
For
flow graph for the same.
independent execution path of a program atleast once. hod. Draw a
Following are the steps that are carried out while performing path testing. (int key, int n, int a [ 1)
od search
Step 1: Design the flow graph for the program or a component.
Step 2: Calculate the nt mid;
cyclomatic complexity. int bottom = 0;
Step 3: Select a basis set of path. 1;
int top
=n-
Step 4:Generate test cases for these paths. 3 while (bottom=top)
( mid = (top + bottom)/2;
Let us discuss each in detail. 4) if (a (mid] = = key)
5)
Step 1: Design the flow graph for the program or a component.
Flow graph is graphical printf (Element is present');
a
representation of logical control flow of the
a
graph consists of circle called flow graph node which basically program. Such
a return;
represents one or }/ end ofif
more
procedural statements and arrow called as edges or links which
control flow. In this flow basically represent else
graph the areas bounded by nodes and edges are
regions. Various notations used in flow graph are (See Fig. 6.7.1) - called
if (a [mid] < key)
8)
bottom = mid + 1;
OStatement 1 else
10) top = mid - 1;
Sequence
OStatement 2 F/end of else
/ end of while
11) }// end ofsearch
True Q alse The flow graph will be
If else
while
botom>toPwhilebottom top
True
False
While
a mid a mid key
==key (6 amid) > key
- afmid key
Casese n
Case
Case
regions
Fig.6.7.2
Fig.6.7.1
TECHNICAL PUBLICATIONS An up thrust
for knowledge An up thnst
or kowdedge
TECHNICAL PUBLICATIONS
w

Test Test Test priority Defect


Test steps everiby
Test Test case Test case case status
name descriptlon Actualstatus (PIF)
ld Step Expected

Set bottom = 0 Initially bottom


Validating Checking the = n
-
1 top will be Design
the list bottom and top
top values for check if true. But during
boundaryy bottom < = top iterations list's
the list of
elements by while loop. length wil be
reduced and if
This condition
defines the entire list gets
length of the Scanned at one
list from which point
the key is (bottom > = top)
searched. will be reached
then return to
main.

Checking Checking if Set mid = (top


Ifalmid]= key
middle + bottom) / 2 value then print
ist
element element of
Design
with key array i equal
Then compare message Element
is present" and
if almid] is
to key value equal to key. return to main.

Set bottom
ifalmid) ís
key value if mid +1 and
The right sublist
almid] is> key
will be searched. Design
then goto The left sublist will
value "while" set top be searched for key
mid +1 and element
go back to
"while" loop
Software Engineering SofvareEngineering
6-25 Software Coding and Testing
6-24 Software Coding and
Testing
Example 6.71 Draw the flow graph for finding maximum of three numbers
testcases using cyclomatic
complexity.
and derive the a>b )o
Solution:T flow graph for given program is -(From Fig. 6.7.3)
redicate
temp a
node temp b
The nodes are
numbered it is shown
in shaded form.
temp a temp b temo
C>temp relum
Predicate
node
tempc temp
R2 Fig.6.74 Flow graph
return
temp c temp Step 3: Add cyclometic complexity.
Fig. 6.7.3 Flow graph for finding maximurm of three numbers
1
23
2-151
1 1
Cyclomatic complexity E - N+2 = 7- 6+2 =3 1-1 =0
1-10
Cyclomatic complexity = P + 1 =2+1 =3
2-11
Cyclomatic complexity = Regions encountered =3
-1 0
Hence cyclomatic complexity of given
program is 3. 213
6.712 Graph Matrices
The resultant value is the cyclomatic
Definition : Graph matrix is a
square matrix whose size is and add 1 to it.
equal to number of nodes the results of each row
of the flow graph. complexity.
For in testing ?
example consider a flow graph - How to extend graph matrix for use
in testing.
graph matrix for
use
The graph matrix will be extend
indicate how to
Following properties nodes get executed.
For between the
computing the cyclomatic complexity. Following steps are
adopted - The number of times of link
Step 1: Create a graph matrix. Mark the corresponding entry as 1 time spent in
traversal ofa link.
if node Ais he processing
connected to node B. required.
i) The number of resources
link
traverse
the
Step 2 Count total number of 1's from each row
and of memory required
to
subtract 1 from each The amount
corresponding row.
Testing
6.7.2 Control Structure
white box testing.
as
sometime called
The
struchural testing is
PUBLICATIONS
A n up
ust
brknowede
TECHNICAL
TECHNICAL PUBLICATIONS An up thrust
for knowledge
Sotwere Engineering 6-27
6- 26 Software Coding and Testing
Software Coding and
S o f w a r eE n g i n e e n i n g
Testing
In structural testing derivation of test cases is
according to program
2 Nested loops
program is used to identify additional test cases. structur.
Hence knowledge of the ture. be tested as follows.
loop can
The nested
Objective of structural testing is to exercise all
program statements. Testing begins
from
the innermost
6.7.21 Condition Testing loop first. At the same time set all
To loops to minimum values.
test the logical conditions in the the other
program module the condition
This condition can be a Boolean condition or a testing is used. test for innermost
relational expression. The simple looP
The condition is incorrect in loop is done.
following situations.
i) Boolean operator is incorrect, missing or extra. the loop testing for the next
i) Conduct
i) Boolean variable is
incorrect loop by keeping the outer loops at
ii) Boolean parenthesis may be missing, incorrect minimum values and other nested
or extra.
iv) Error in relationaloperator. loops at some specified value.
v) Error in arithmetic This testing process is continued
The
expression. iv)
condition testing focuses on each
The branch testing is a condition
testing condition
testing strategy
in the
program.
in which for a

until all the loops have been tested.


3.Concatenated loops:
O
condition each and every true or false branches are tested.
compound Fig. 6.7.6 Nested loops
The domain testing is a
The concatenated loops can be tested in
testing strategy in which relational
expression can be the same manner as simple loop tests. (Refer Fig. 6.7.7
using three or four tests. tested
4. Unstructured loops:
6.7.2.2 Loop Testing The testing cannot be effectively
conducted for unstructured loops. Hence these types
Loop testing is a white box 6.7.8)
constructs. testing technique which is used to test the
of loops needs to be redesigned. (Refer Fig.
Basically there are four types of
loops. loop
1. Simple loops:
The tests can be
performed for n number of classes.
where
i) n
=0 that means
skip the loop completely.
i) n =
1 that means one
pass through the loop is tested.
i) n =
2 that means two
passes through the loop is
tested.
iv) n m that means
=
testing is done when there are
passes where m < n. m
-
v) Perform the testing when number of
n, n+ 1. passes are n
1,
Fig. 6.7.5 Simple loopP
Fig.6.7.8 Unstructured loops
Concatenated loops
Flg. 6.7.7
TECHNICAL PUBLICATIONS A n up
thrust forknowiedge
An up thust PUBLICATIONS
for knowledge TECHNICAL
Sofhware Engineering 6- 28
Software Coding and
Sofwere Engineering
6-29 Software Coding and Testing
Testing
6.7.23 Data Flow Testing
.The testing based on data flow mechanism
performs testing on
definitions
of variables in the program.
uses and
.In this method of testing, definition and use chain (DU
chain) is required. The Dt
chain is obtained by identifying the def and use
pairs from the program struchie
This of re.
testing is also called as DU testing strategy.
strategy Wile
Set DEF(n) contains variables that are defined at node n.
Set USE(n) contains variables that are read or used at node n.
For example
1. S:=0;
2. a:=0;
3.
4.
while(a<b)
a:= a+2;
. b=b-4;
6. iffatb<20)
7. S=s+atb;
else
8. S:Sta-b;
For above given programming lines the DU chain will be -
DEF(1) = ls} USE(1) = {o%
Fig. 6.7.9 Flow graph
DEF(2) = la) USE(2) = {0}
DEF()= ( USE(3) Review Questions
=
la, b}
Condiion testing iü) Loop testng
DEF(4)= (a} USE(4) = {a) 1. Explain the following: i) flow
? How a t dtermnei for
a
What is ayclomatic complerity
2. What is basis path testing?
DEF(5) =
b} USE(5) =
{b} example
with an
Sraph ? lustrate
module. Justify uwith ezmple.
DEF(6) = (o USE(6) = la, b} statements in a program
covers all
. B a s 1 s path testing
methods.
and lop testing urth ezample
DEF(7) = s} USE(7) = (s, a, b} 4 Explain the graph matrir gruph ?
lastrate
it determined for aflow
Hoo is
is cyclomatic complexity? flow graph usung
the cyclomatic complerity
What
DEF(8) = (s} USE(8) = ls, a, b}
. What is cyclomatic complerity?
Define steps to fnd GTU:Summer-2012,
Marks 7
DEF9) = (o USE(9) = lo Summer-2019,
Marks 7
umple.
GTU : Winter-2017,
bor testing with graph.
am
flow
DEF(10) l0 USE(10) =(0) 7. Explain white
cyclomatic
complez1ty wSung
? Define steps tosrd
3
20O18, Marks
is cyclomatic complerity GTU: Winter-2017.
Identify all DU pairs and construct test cases that cover these pairs. .What
7
Marks
Identify all DU paths That means for each DU pair (n1, n2) for variable a GTU: Winter-2013,
exercise al possible paths nl..n2 that are clear of definitions of a. 6.8 Black-Box Testing testing
Identify all uses That means for each DU pair (nl, n2) for a, exercise behavioural
path n..n2 that is clear of definitions of a. atleast on The black box testing
is also called
as
hrust for k n o w o d g e
An up
PUBLUCATIONS
TECHNICAL
TECHNICAL PUBLICATIONS An up thrust
for knowledge
Software Engineering
- 30 S o f t w a r eE n g i n e e r i n g
6-31 Software Coding and Testing
Software Coding and
Black box Testing
testing methods focus on the functional For example
Test sets are derived that fully exercise all functional
requirements of the software
The black box requirements. Area code Input condition Boolean The area code may or may not be present
testing not an
different class of errors than whitealternative to white box testing and it 700.
Value defined between 200
Input condition, range and
-
box
testing uncovers
Why to perfom black box Dassword: Input condition, Boolean A password may or may not be present
testing ? Seven character
Input condition,
value
string.
-
Black box testing uncovers
1.
following types of errors. Command: Input condition, set Containing commands noted before.
Incorrectmissing functions
or
2. Interface errors
3. Errors in data 6.8.2 Boundary Value Analysis (BVA)
structures
4. Performance errors . Boundary value analysis is done to check boundary conditions
5. Initialization or termination .A boundary analysis is testing technique in which the
value a elements at the
errors the domain selected and tested.
edge of are
6.8.1 Equivalence Partitioning .Using boundary value analysis, instead of focusing om input conditions only, the
Input set
I t is test cases from output domain are also derived.
a
black box technique that divides the that complements
input domain into Boundary value analysis is a test case design technique
classes of data. From this
data test cases can be derived. o oo equivalence partitioning technique.
o o
An ideal test case uncovers .Guidelines for boundary value analysis technique are
a class of errors values x and y, then test
that might require Valid input Invalid input 1. If the input condition specified the range bounded by
to be executed before
many arbitrary test cases
cases should be designed with values x and y. Also test cases should be with the
observed.
a
general error is
values above and below x and y.
should be
In of values then the test cases
equivalence partitioning the equivalence 2. If input condition specifies the number
well as with the values that
are
lasses are evaluated for System and maximum values as
given input designed with minimum should be tested.
condition. maximum and minimum
Equivalence
class Just above and below the
of valid or invalid represents a set the range by x and y, then test
bounded values
states for
input conditions. 3. If the output condition specified should be with the
values x and y. Also
test cases
.Equivalence class guidelines can be as given cases should be designed with
below values above and below x and y.
should be
then the test cases
If input condition specifies condition specifies the number of values with the values that are
range, one a O t output well as
maximum values as
valid and two invalid aesigned with
minimum and
should be tested
are defined.
equivalence classes below the maximum and minimum
Just above and boundaries then the test cases
If structures specify such
an
input condition requires .It the internal program
data
boundaries of data structure can be
value, one valid and
a
specific Output generated
be designed such
that the values
at the
two invalid must
equivalence classes are defined. Fig. 6.8.1
tested.
If an
input condition specifies a
member of
equivalence class is defined. a set, one valid and one invalid For example: condition -2, 10],
with input
If an input
condition is Integer D
is defined. Boolean, one valid and -2, 10, 11,
-
1, 0
one invalid Test values
equivalence class
TECHNICAL PUBLICATIONS An up thrust
for knowledge
An up thrust for PUBLICATIONS
knowledge TECHNICAL
Software Engineering 32 6-3
Softwere Coding and SotwareEngineering
Software Coding S
and t n g
sting
If input condition
specifies a number values, test cases should developed to evo
below this min andercise
the minimum and maximum numbers. Values
Runs
just above and
It denotes the number of rows in the
should be tested. max array. These can be directly translated to the
test cases.
Enumerate data E with input condition {2, 7, 100, 102
Test values 2, 102, -1, 200, 7 Factors
of columns in the array. These can be
t denotes the number directly translated to
6.8.3 Graph based Testing maximum number
of vanables that can be handled by the array.
Graph based testing:
I n the graph Level
based testing,
a
graph of objects present in the
Object Directed link This number denotes the maximum number of values that a single factorfcoumnm) can
system is created. # 1 Object
#2 take.
.The graph is basicallya Node L9 orthogonal array
collection of nodes and links. |Undirected weight
link This array is used to generate the test cases. This array
has a balancingg property.
Each node
represents the object Parallel the test cases generated by
that is
inks That means the testing can be done uniformly by executing
participating in the
Bidirected link the L9 orthogonal array.
software system and
links Object Object
#4
represent the relationship link weight
among these objects.
Example
Fig. 6.8.2 Graph notations application which has three sections top,
Consider that we want to develop an
The node weight represents the bottom and middle.
properties of object and link weight represents the properties or characteristics Associated with each section we will consider one variabie. That means now we
the relationship of the of
objects. have to analyse only three variables
After creating the hence the values can be
graph, important objects and their with Boolean values and
relationships are tested. These variables can be assigned
6.8.4 Orthogonal Array Testing true or false.
then there would be 2
= 8 test cases
f we decide to test it completely
There are many the values to L9 orthogonal array
applications for which very small number of input is needed and orthogonal array testing
method, mapping
values that each input
requires might be bounded. In such a situation the number of By
test is would be
cases
relatively small and can be
increased then it will increase there will bemanageable.
But if the number of actors
input gets factor2
large number of test cases. And factor aise
become impractical or
impossible. Orthogonal array testing is a kind of testing may Run1 false
false
false
false
which can be applied to the
applications in which input domain is testing method
Run2 true true
taise
there could be large number of test
cases.
relatively small but Run3 false talse
true
faulty regions can be tested and thus the numberUsing orthogonal array testing method,
only Run4/false
Vaniable from
of test cases can be reduced. Variable from
third section
Orthogonal arrays are two dimensional arrays of Variable from
second secton
is true SU
interesting quality that by choosing any two columns numbers which possess the
in the 1 section
distribution of all the pair-wise combinations array you receive an even Is true
ofvalues in the levels.
important terminologies used in orthogonal array. Following are some left to all the
the values
are
testing methods -

Thus
would be
Now the test cases
up thrust for knowiedge
TECHNICAL PUBLICATIONS An up TECHNICAL
PUBLICA7ONS
An
thrust for
-
knowledge
SowereEngineering
6-35 Software Coding and Testing
Software Engineering - 34
Software Coding and Testing
The advantage
of conducting black box testing is to uncover following types of
1. Display the application without any section. 2 The
2 Display the application with top section only. errors
i Incorrect or missing functions i. Interface errors
3. Display the application with the middle section only. ii. Errors in external data struchures iv. Performance errors
4. Initialization termination errors
Display the application with the bottom section only. V.
or
Thus there are only four test cases in all and no need to test all the
combinations n
Disadvantages
fact we have considered this test cases by considering the single parameter. be tested.
This kind n 1. All the independent paths within a module cannot
testing is called single
mode fault detection. By considering these test case
the faulh false sides cannot be tested.
can be fixed. 2. Logical decisions along with their true and
and the boundaries of these loops cannot be exercised with black box
Double mode fault detection In this method, two parameters can be considered 3. All the loops
at
a time for determining the number of test cases. testing.
cannot be validated.
4. Internal data structure
Advantage
White box Testing
The orthogonal array testing approach enable the developer to
provide good Advantages and Disadvantages of
test
coverage with very few test cases.
Advantages
The intermal structures, data flows,
Review Question 1. Each procedure can be tested thoroughly.
can be tested in detail
logical paths, conditions and loops
1. What is black box testing? Explain any one technique to carry out black box
testing. 2. It helps in optimizing the code.
GTU: Winter-2013, Marks 7 be easily automated.
3. White box testing can of
it is easy to find out
which type
6.9 Comparison between Black Box and White Box Testing 4. Due to knowledge of internal coding
structure
the application efficiently.
GTU: Winter-2012, Summer-2015, Marks 7 input data can help in testing
Sr. No. Black box testing Disadvantages for the tested. Thus the
White box testing structure and coding is desired
internal
1. The knowledge of this the cost is
testing
1. Black box testing is called behavioural White box testing is called for whitebox testing Due to
testing. glass box skilled tester is required
testing
2 Black box testing9 examines some increased.
of the software and hence
In white box path
fundamental aspect of the testing the procedura difficult to est
each and every
system of
ite regard for intemal logical structurewith
details, all the logical paths, all the 2. Sometimes it is
internal data structures are closey untested.
the software many paths may go ditficult because
it may use specialized
3.
examined white box testing
is very
During black box testing the program White box testing lead to test the 3. Maintaining the tools are required.
cannot be tested 100 and debugging
percent. program thoroughly. tools like code analyzer identiñed.
This type be
of testing is suitable for
large This ype of testing is suitable for small functionality
can not
projects. 4.The missing
projects.
Advantages and Disadvantages of Black box Testing Review Questions GTU: Summer-2015, Marks 7
Advantages: black box and
white box testmg
Black bax and white box testing
.Explain tester"comptre
role of
1. The black box What s the GTU Winter-2012. Marks
testing focuses on fundamental
aspect of system without beng 2. What is software
testing?
concerned for internal logical structure of the
software.
thrust for knowiedge
An up
PUBLICATIONS
TECHNICAL
TECHNICAL PUBLICATIONS An up thrust
for knowledge
Softwere Engineering - 36 6-37 Software Coding and Testing
Software Coding
tware Engineering
and
Testing
6.10 Testing Technique and Test Case GTU: Winter-2019, Marks 3
Precondition
Test cases are used to determine the presence of tault n the Test Test case Test steps Test case Test Defect
program. Sometimea Test
even if there is some fault in our description status priority severity
program the correct output can be obtained for case id
case
some
inputs. Hence it is necessary to exercise those set of name Pass/Fail)
a
for which falta
lts inputs Step Expected Actual
(if any) can be exposed off.
Executing test cases require
money because i) machine time is
execute test cases ii) human efforts are involved in
required to
executing test cases. Hence in
the project testing minimum number of test cases should be there as
far as
possible.
The testing activity should involve two goals
i) Maximize the number of errors detected.
ii) Minimize the number of test cases.
in the testing process. Careful selection
.Test case specification is the major activity
The selection of test case should be such that faulty module or
program segment of test cases will help in conducting proper testing
must be exercised by at least one test case.
specification should be before using
There are two basic r e a s o n s why test
case
Selection of test cases is determined by some criteria which is called tester to reveal as many e r r o r s as
test Firstly it will assist the
as
selection criterion. Hence the test selection criterion T can be defined as the them for testing -
be produced.
set of and secondly the high quality code
can
conditions that must be satisfied by the set of test cases. possible from the program
Testing criterion are based on two fundamental properties Test Case Execution
reliability and 6.10.1
validity. to execute the test cases.
After test case specification the next step is
A test criterion is reliable if all the test cases detect same set of errors. stubs
A test criterion is valid if for any Execution of test cases requires driver and
error in the program there is some
set which procedure is sometimes called as
test procedure
causes error in the The test case execution
required for
program. consists of special requirements
specification. This specification of testing
the format of reports
For testing criteria there is
reliable if
an
important theorem "if testing criterion is valid and
setting up the
test
environment. It also
describes
a set satisfying testing criterion succeeds then that means
program
contains no errors".
results.
is test summary report and
during testing
The most common report produced
Generating test cases to satisfy criteria is complex task. used in
error report. cases and is
executon of entire test
.The test case
specification records the results of the testing, the conditions used for describes the defects encountered
T h e test summary
report the errors
and
testing particular unit. It also specifies the expected test results. It records the The error report specifies
outcome of test project m a n a g e m e r n t .
cases (Pass/Fail). The sample structure of a test case
specification during testing to estimate the test efforts.
mportant
is as
given below execution of test cases
it is in testing activities, and
During the by the t e a m
effort actually spent
is the total is being performed.
Testing effort s u t f i c i e n t testing
whether or
not
indicator of
is an
3
Review Question GTU: Winter-2019. Marks
case
of test
1. Explain concept
An up thnust for know
wiedge
PUBLICATIONS
TECHNICAL
TECHNICAL PUBLICATIONS An up thrust for knowledge
Sotware Engineering Software Engineering 6-39 Software Coding and sting
6-38
Software Coding end Testin
6.11 Test Suites Design 6.12 Testing Object Oriented Applications
.Test suite is a collection of various tests that The object oriented architecture is a layered subsystem that contains various
help the tester in
executino aborating classes. The collaborating classes perform various functions to achieve the
reporting the test case execution. and
system r e q u i r e m e n t s .
Various test cases can be added to test suites.
.The test suite In this section we will discuss various object oriented testing methods
can be generated from the test plan. Refer Fig. 6.11.1.
6.12.1 Conventional Test Case Design Methods
Test plan
white box testing: The white box testing methods can be applied to operations
defined within the class. Various testing methods such as loop testing, basis path testing
are useful
in testing every programming statements.
Test The black box testing methods are also useful for 00 system
Sute 1
Test Test Black box testing:
Suite 2 SUite3
testing. The use cases in object oriented design provide the input to the black box testing
method.
6.12.2 Fault based Testing
Test Test Test est Test
case 3 case 1 case 3 of testing method in which plausible
case The fault based testing method is a kind
identified.
Test Test
faults (appearntly valid) are
Test
three types of faults and
those are wrong operation
case 2 case 2 The integration testing detects
case 2 invocation.
incorrect
used, unexpected result,
Fig. 6.11.1 Test suite preperatilon F o r determining the plausible
faults various operations areinvoked.
to data attributes
and operations of the class
The test suite often also contains The integration testing is applied
more detailed instructions or
goals for each
collection of test cases.
6.12.3 Scenario based Testing
The test suit document contains the not focus on
two main areas
fields such as a test case ID, test is that it does
step or
-
order of execution number, related fault based system various
T h e drawback of 2. interactions among
and check boxes for whether the requirement(s), depth, testcategory, author, and those are 1.
What are the
users' requirements
test is manual or and has been automated.
Each test case
represents some scenario. For
subsystems. what the user
wants from the system (users
purchase contain various test cases as - example a test suite for online
Scenario based subsystem
focuses on
Hence test cases
Test Case#1: Login expectations). the scenarios.
are
uncovered by building
interaction errors
Test Caset#2: Search for Product Many based testing are complex
for scenario test.
that are created subsystems using a single
Test Caset3: Add Product to multiple Suppose he
Cart based testing
focuses on
who has a credit card.
Scenario customer
Test Caset#4: Checkout example of
a
customer of that bank, his
us take an
it Being
the
."Test suites Example Let -
bank about
by simply
changing
can
identify gaps in a
testing effort where the successful compleion of lost his credit card.
So informs
in the
banks computer.
Ideally,
available. But many
one test case must occur be stored his history
before you begin the next test case. information
must
of card'
should
make
history 'renewal
has to be entered.
as a
the status of his card of that
customer
information
the complete
ames
An up
hnust
for knowledge
PUBLICATIONS
TECHNICAL
TECHNICAL PUBLICATIONS An up thrust for
knowledge
-
ofware Engineening 6-41
Softwere Engineering - 40 Software Coding and
Software Coding and Testing Testing
So if scenario testing would have been done for this test , In use-based testing the Integration testing
scenario this buo independent classes and
have been found well in advance. would
e
dependent classes are
6.13 Object-Oriented Testing Strategies tested. The independent
classes are those classes that Thread based Use-based
The primary objective of testing for
object oriented software is t uncover as much testing testng
errors as possible with uses the server classes and
manageable amount of efforts in realistic time span.
The object oriented testing dependant classes are those
strategy is identical to conventional
The strategy is start testing in small and work testing strateev classes that use the
outward to
basic unit of testing is testing in large. The
class that contains attributes and independent classes. In use Independent
cdlass testing
Dependent
dlass testing
operations. These classes based testing the
integrate to form object oriented architecture. These are called Fig.6.13.1 Integradon testing in O0 context
classes. collaboratine independent classes are
tested at the beginning and
6.13.1 Unit Testing in 00 Context the testing proceeds towards testing of dependent classes.
.Class .Drivers and stub : In 00 context the driver can be used to test operations at
is an encapsulation of data attributes and
corresponding set of operations. lowest level and for testing whole group of classes. The stub can be used in the
The object is an instance of class. Hence
and operations.
a
objects also specify some data attributes situations in which collaborations of the classes is required and one coilaborating
class is not fully implemented.
In object oriented software the focus of unit
testing is considered as classes or The cluster testing is one step in integration testing in 00 context. In this step all
objects the collaborating classes are tested in order to uncover the errors.
However, operations within the classes are also the testable
units. In fact in O0 and Conventdonal Testing
context the operation can not be tested 6.13.3 Difference between 00 Testing Strategy
single isolated unit because one
as
operation can be defined in one particular class and can be used in
Strategy
classes at the same time. For multiple
example consider the conventional software are based on unit testing
operation is defined as super class an at the same time itoperation display0.
can be used
This T h e testing strategies applied to
and system testing But in object oriented
bemultiple derived classes. Hence it is not possible to test the by the can integration testing, validation testing and integration testing changes
some of its meaning
module. operation as single testing, the unit testing loses
Thus class testing for O0 significantly. "test in small
software is
equivalent to unit is also based on the principle
software. In conventional software testing for conventional T h e object oriented testing strategy
flow are units of system, the algorithmic details and data that and then work "in the large". the main focus
testing but in O0 software the class attributes and operations;
encapsulated
lasses and 1. Testing in the small involves
operations (that are encapsulated within the class and state behavior and collaboration within the class.
the unit of of class) are is on
communication
testing. involves a series of regression
tests to uncover errors due
2. Testing in the large classes
6.13.2 Integration Testing in 00 Context to
communication and collaboration among
errors in hulfilling requirements.
to detect
as a whole is tested
.There two
are
strategies Finally, the system
1. Thread based testing
used for integration testing and those are -
2. Use-based testing
.The thread based
testing
Review Questions
event for the integrates all the classes that respond to oriented testing strategies.
system. Each thread is then tested
one
input o 1. Explain the object and comoentional strategy.
individually. 2. Differentiate
betueen 00 testing strategy
PUBLICATIONS
An up thrust for knowtedge
TECHNICAL
TECHNICAL PUBLICATIONS An up thnust
for knowledge
-43
shwereEngineerning
vare Coding and Tes
Software Engineering 6- 42
Software Coding and
Testing Component testng
6.14 Testing Web Applications
onent testing the content and functional units are tested. For web application
n
The process of testing
begins with content testing. Fig. 6.14.1 shows the nit
to the web page (containing web contents,
unit refers
refer
navigation links and
pyramid with associated testing strategies. The testing flow proceeds from left todesien
tern
he it
may be a functional component that provides the services
elements) or
and from top to bottom. right grocessing
p r to the user or it can be intrastructure component. The testing of each functional
direc
is
unit
done in the same manner as an individual module tested in comventional
This testing is mainly of black box testing but sometimes if the processing is
Content testing Interface testing software.
nlex
compl
then the white box testing may also be used. Ater constructing the web
User are used as
srchitecture, the navigation
and component testing test For integration
Navigation architecture is considered. If the web architecture is linear,
testing integration testing,
the web
be integrated and tested
rid or simple hierarchical structure then all the web pages can
Interface manner as a conventional software.
design Component in the same
testing to that side effects occur. Cluster testing
Aesthetic design Regression testing is applied ensure no
web pages and those are tested for uncovering the errors
integrate all the collaborating
Content design Configuration in collaboration.
testing
Navigation design
|Performance
testing
Security Configuration testing
Architecture design testing uncovers the errors particularly from client server environment.
Configuration testing browsers, operating
Component design used in this testing. All probable
A cross reference matrix is used for testing compatibility
communication protocols are
systems, hardware platforms mentioned configuration and
Technolog9y conducted for all the above
the web application. Tests are
Fig. 6.14.1 Testing process errors are uncovered.
Content testing
Security testing in web applications
and its
Content testing is for vulnerabiliies
uncovering the errors from the web document. Such
testing is Ihs testing is useful
to expose the
similar to proof editing of the document. The
in cross
typographical error, grammatical mistakes, environment.
errors
referencing, errors in graphics can be exposed off.
User interface testing Performance testing -
are assessed
things when user
performance testing following web application
In this testing, the interaction mechanism and
aesthetic aspects of the
n
time and reliability of a
are tested.
user interface How is the response
increased ? of
traffic gets tor degradaaon of performance
Poorly implemented interaction mechanisms, inconsistencies and those components
responsible
newly introduces interfaces all such errors are uncovered in user ambiguities caused
W h i c h are
in
? objective and
interface testin8 the web application degradation
on
overall
of performance
Navigation testing What is the impact ?
of web application
Navigation testing is concermed with use cases. The test cases for requirement
are designed to exercise usage scenario
navigation testing Mobile Applications
against navigation design. Navigation 6.15 Testing
which application
mechanisms implemented within the interface B a
proess by
NSUs. In this kind of testing the use cases are layout
testing usability
are tested application unctionality,
against use-cases and or
mobile
devices is
tested tor its
identified correctly and are corrected. Mobile testing
handheld
mobile
for
Software developed thnust or knowiedge
An up
PUBLICATIONS
TECHNICAL PUBLICATIONS
TECHNICAL
An up thrust
for knowledge
Softwere Engineering 6-45
6-44 Software Coding and Testing Software

Engineering
Software Coding and Testing
and 6.16 Testing Tools
consistency. There is change in behavior and usage pattern of mobile
applicaa
Testing mobile application is more complex and fime
traditional desktop and web application.s Hence there areconsuming
as
comparedd to
plications. sting is
omated software testir becoming more and more
important for many software
mobile application testing
some major
challenos
nges in project

in order to automatically verify key functionality.


Various
areas in whi automated testing tools are used are -
Challenges in Mobile Testing
automated testing tools can be used for reviews,
1. There is a . The walkthroughs and inspection.
huge number of mobile devices available ranging from
ipads and wearable tech provides a huge handsets, to
smart phones, to tabs, to The tools can be used tor various activities such as regression testing, defect
environments which the mobile diversity of management, test management and so on for a stable system.
application faces.
2. There is
diversity in mobile network operator such as CDMA, Configuration tools can be used tor contiguration control and version
management.
The mobile GSM and so on
applicatiorn has to work in these diverse on.
environment.
3. A mobile app Advantages of using Automated Testing Tools
can be a native app, a web
app or a hybrid app which has 1. The testing becomes reliable and there is no chance of human error.
contents. Testing of each such both
app type is different than
implementation is another as their
quite different from one another. 2. The testing tools are reusable.
4. There are different operating systems for mobile such as Android, 3. The testing becomes efficient due to use of automated tools.
and so on. Each operating ios, Windows
system has its own limitation. Testing the 4. The cost involved in testing gets reduced due to use of automation.
work on diverse
operating system is real challenge.a application to
5.
Choosing the test method for mobile Disadvantages of using Automated Testing Toois
application can be tested on emulators application
is also one
challenge. The mobile
tested
or on actual
emulators and trying out different
on
devices. Some issues can not be
1. The high investment is needed in training the people to use the tool
types of devices is time 2. The people involvement is required for test preparation
consuming. and cost
3. Many times a lot of testing areas left uncovered.
Criteria used for Mobile
Testing Let us discuss some examples of testing tools
1.
Testing the mobile application to ensure that it is working as per the requirements.
2.
Testing the mobile application to work on 6.16.1 Win Runner
different OS
networking environment. platforms, devices and automation tool It is the most
3. WinRunner is Mercury Interactive's enterprise
Testing the mobile application
notifications, data cable insertionduring
the commonly used automated testing tool
interrupts such as incoming calls, SMS,
removal and so on.
or
4. Testing the mobile application for Features
devices. installation, un-installation, updation user to set up varnious operaions
that
on the Automatic Recovery It is possible for the
will
5.
Testing the mobile event appears. The recovery manager
application for will become activated if an exception
and data security. security i.e. to check for
attacks, will allow you to set up
a scenario for recovery.
authentication 81ve you a wizard that
be set for WinRunner.
installation mode can
2Silent Installation: The unattended
Review Question support for Internet
WinRunner incudes
Environments:
For Various
1. What is mobile . Support 6.x, Windows XP and Sybase 's Power Builder 8, in
testing? Mention the Explorer 6.x and Netscape
challenges in mobile testing. addition to 30+ environments.
and
most powertul, productive
WinRunner provides the
Cost Effective
application hunctionality.
4. :
cost-effective solution for verifying enterprise
TECHNICAL
PUBLICATIONS An up thust
forknowedge
for knowiedge TECHNICAL
PUBLICATIONS
An up
thrust
Software Engineening 6 46 Software Coding and
Testing
5. Support Multiple Data Combination: WinRunner has an ablity to use
umerous
data combinations for one test. The DataDriver Wizard has been
automatic processing of large amounts of data.
desiened
Quality Assurance
6. Multiple Verification: It can
offer checkpoints for
and this will give the testers the ability to compare
outcomes that occur. In addition to this, it is able to find
various objects that are GUI based.

text, URL, GUI and


the expected outcomes
databases
with the
specific problems with
7 and Management
6.16.2 Load Runner
Syllabus
HP Load runner is a software testing tool from Hewlett-Packard. It is used
to test Quality concepts and software quality assurance, Software reviews (Formal
applications, measuring system behaviour and performance under load. HP Load runner Software reliability, The quality standards: IS0 9000, CMM Si sigma SE technical reviews),
can simulate thousands of users
concurrently using application software, recording and - for SQA
plan
lateranalysing the performance of key components of the application. Contents
Features 7.1 Quality Concepts
Summer-2019, . . Marks 3
1. It has excellent and 7.2 Sofware Quality Assurance (SQA)
monitoring analysis interface where tester can see
reports in Winter-2011, 2013, 2018,
easy to understand colored charts and graphics.
2. It uses C as a default
. Summer-2012, 2014,
programming language. However, it also
supports other 2016, 2018, Marks7
languages like Java and Visual Basic. 7.3 Software Reviews
.Winter-2018, 2019,
3. No need to install it on the server under test. It uses native monitors.
Summer-2019, Marks 3
4. It has support for most of the commonly used protocols.
a 7.4 Software Reliability
5. It has GUI
generated scripts which can be modified per the requirements. as 7.5 Quality Standards
Summer-2014,
6. This tool can quickly point out the effect of the .. Winter-2017, 2018,
wide area network (WAN) on Marks7
application reliability, performance, and response time. 7.6 SQA Plan
Review Questions
1. Explain the concept of automated
testing tool along with advantages and disadvantages of it.
2. Write a note on 1) WinRunner 2) LoadRunner.
-
O00
TECHNICAL PUBLICATIONS -
An up thrust for
knowledge

You might also like