Download Search Base Software Testing With Genetic Algorithm Using Fitness

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
INTERNATIONAL JOURNAL OF ADVANCED ELECTRONICS & COMMUNICATION SYSTEMS
Approved by CSIR-NISCAIR ISSN NO: 2277-7318
INTERNATIONAL CONFERENCE ON MODELLING AND SIMULATION IN ENGINEERING AND TECHNOLOGY ICMSET-2014, 15-16 FEBRUARY, 2014
Search Base Software Testing With Genetic
Algorithm Using Fitness Function
1
G.M.Lodha, 2Manav Thakur, 3Rahul S.Gaikwad
Godavari College of Engineering, Jalgaon, Maharashtra, India
I.INTRODUCTION
In software testing is branch of engineering in which
white box testing is very important while concerning the
any software program. and we are going to implement
such system which produce software testing output in the
form of test case and we can find best test sequence to
test data generation. In fact to cover a particular branch
of code a sequence of function call is required. So we are
implement system which is known as search based
software testing in which we can test an software program
code and generate test case. we are use a techniques to
implement this kind of system. so we are using search
algorithm for this kind of system. In which we are first
search target branch that can have minimum length of
code.
Then we can give some input to test that code and then
we can generate an test case which produce an output like
no of Line Of Code. No. of branch are involve in that
software program. and test report that give the small bug
description if that software program have some error or
bug. Also to generate an error report or bug report we
first take an control on that software program the execute
that program and generate an bug report
A short test
sequence is not only quicker to compute, but it would also
be easier to understand when the oracle (used to obtain
the expected output) is a software developer. On one
hand, choosing a fixed length has the disadvantage that it
could be too short to cover the target. On the other hand,
searching for the best length complicates the automation
of software testing. In this seminar, I analyze the role that
the length of test sequences plays in testing software with
internal state. In particular,
I concentrate on the branch coverage criterion because it
is one of the most common criteria in the literature. To
obtain high coverage, a common practice is to apply a
first phase of random testing, followed by more
sophisticated techniques aimed at covering the remaining
branches (control flow analysis can be used to reduce
their number by considering their dependences, e.g.,
nested branches).
In fact, many branches are easy, and using expensive
techniques to cover them would not be cost effective.
Some examples are formally proven in At any rate, this
approach has two main issues because there can be
branches that are infeasible. First, we need to decide how
long to apply random testing. Second, when we target
specific branches, we need to decide as well how much
effort we want to spend in trying to cover them. In fact,
some of them could be infeasible. Only if we obtain 100
percent coverage can we be sure that we can stop the
search effort. At any rate, when we target one branch at a
time, it is very important to keep track of the other
branches that can be covered by chance
Keywords: software testing, Genetic algorithm,
searching.
II.OTHER SEARCH TECHNIQUES
1)
Random Search
RS is the simplest search algorithm. Random
solutions are sampled until a global optimum is found.
The information given by the fitness function is only used
to check whether a global optimum has been sampled. RS
is commonly used in the literature as a baseline for
comparing other search algorithms. What distinguishes
among RS algorithms is the probability distribution used
for sampling the new solutions. We employ a uniform
distribution, as commonly done in the literature.
2)
Hill Climbing
HC starts from a search point, and then it looks at
neighbor solutions. A neighbor solution is structurally
close, but the notion of distance among solutions is
problem dependent. If at least one neighbor solution has
better fitness value, HC “moves” to it and it recursively
looks at the new neighborhood. If no better neighbor is
found (i.e., the current solution is a local optimum), HC
restarts from a new solution. HC algorithms differ on how
the starting points are chosen, on how the neighborhood
is defined, and on how the next solution is chosen among
better ones in the neighborhood. We choose the starting
ISSUE 3 VOL 3 JUNE-JULY ICMSET 2014 PROCEEDINGS
INTERNATIONAL JOURNAL OF ADVANCED ELECTRONICS & COMMUNICATION SYSTEMS
Approved by CSIR-NISCAIR ISSN NO: 2277-7318
INTERNATIONAL CONFERENCE ON MODELLING AND SIMULATION IN ENGINEERING AND TECHNOLOGY ICMSET-2014, 15-16 FEBRUARY,
2014
points at random. The neighborhood N is defined by
swapping one single method at one time (i.e., an insertion
is replaced by a removal and vice versa) without altering
the inputs and by modifying each input by 1%l. Hence,
the neighborhood has size. The strategy to visit the
neighborhood starts from left to right in the representation
(i.e., the method in the first function call is modified, and
then the second visited neighbor consists of adding 1 to
the input of the first method, etc.). As soon as a better
solution is found, HC moves to it. In visiting the new
neighborhoods, instead of starting from the leftmost
variable, HC starts from the successive of the last
considered (whose modification has led to a new better
solution), and it continues toward the rightmost, then
coming back as in a ring to the leftmost and finishing
moving right until all neighbors have been visited.
3)
Evolutionary Algorithm
EA is a single individual evolutionary algorithm. A
single offspring is generated at each generation by
mutating the parent. The offspring never replace their
parents if they have worse fitness value. In a binary
representation, a mutation consists of flipping bits with a
particular probability. Typically, each bit is considered
for mutation with probability, with k the length of the bitstring. In our case, a test sequence is composed of l
function calls. We consider the methods in the test
sequences as bits (e.g., 0 to represent an insertion and 1
for a removal), and the method inputs as groups of bits
that are mutated together with a special operator.
In case of a mutated input, a new different valid value
is chosen with uniform probability. In the case of variable
length, as for HC the starting length is chosen at random.
In the same way, we consider the removal and insertion
of new random function calls. Besides, to the previously
described mutation, with probability p (e.g., p ¼ 0:5), we
add/remove a random function call. If that mutation
happens, we again do the same type of mutation, but with
probability p2. Again, if this latter happens, we do a third
mutation with probability p3, and so on with probability
pt, where t1 is the number of mutations done so far on an
individual when an offspring is sampled.
III.RELATED WORK
In the area of software testing Richard torkar [3][2009]
and Wasif Afzal[4][2009] are work on non functional
properties and provide detail regarding to Execution
time,Qos and usability testing which help us for our
future work. Then MR.Robert Feldt [5][2010] had work
on fitness function and study quality assesment and data
extraction.in which they provide concept of fitness
function and maintain quality of software.
MR. Baresi [6][2009] and M Miraz [6][2009] has
work on evlutionary algorithm hence easy to work on
genetic programming. In which working of evolutionary
system provide only non functional properties such as
black box testing .but they are not worked on length of
test case and measurement of code .Marinow and D.
Notkin [7] [2010] provide much more information about
unit test in which he carried out the work on unit testing
and carried out work on unit or module wise testing.
using some idea about genetic algorithm. In which he
provide the idea of white box testing and how to generate
test case.
P.McMinn [8][2004] introduce an analysis of “test
data generation” in behavioral structure in which they
provide test data for set of test case. also provide the work
on automated test data and verification and validation
testing with reliability of testing. S.kurshid [9][2010] give
us java path finder and theory of complex data structure
and give information about black box testing. Also
provide how to use java path finder for search based
algorithm and give us fruit fool information. in the area of
search based software testing.
A. Arcuri and X. Yao [10][2008] “Search Based Software
Testing of Object- Oriented Containers,” provide data
related to object containers data and search based testing.
IV.PURPOSED SYSTEM
In search based software testing I am going to perform
work on test case generation. in which we are fully
concentrate n white box testing also in this purposed
system we are provide an report that show how the test
case are useful for the software developer and software
tester to test the software. Hence mainly we focus on
structural code coverage. Also we can check the role of
line of code. The goal is to obtain test sequence to cover
white box testing. And Provide theoretical result on role
of length. Measure test length and Line of code.
We use rank based selection with valid value such that
high chance to select them for testing. here we give rank
to test sequence and from that test sequence or test case
we can search particular test data generation of test input.
Hence rank selection is parameter used to select close to
selection. This selection is optimal solution which is
ISSUE 3 VOL 3 JUNE-JULY ICMSET 2014 PROCEEDINGS
INTERNATIONAL JOURNAL OF ADVANCED ELECTRONICS & COMMUNICATION SYSTEMS
Approved by CSIR-NISCAIR ISSN NO: 2277-7318
INTERNATIONAL CONFERENCE ON MODELLING AND SIMULATION IN ENGINEERING AND TECHNOLOGY ICMSET-2014, 15-16 FEBRUARY,
2014
purely based on searching characteristics of an object. We
use population of no of sequence for generation of best
solution. For variable length we select random length
{1…L} then mutation is done with variable length.
In GA an initial population of candidate solution is
produce with help of following three approaches our aim
is to produced test set that achieve high code coverage.
The fitness function measure the minimal branch
distance for target class basically sum is calculated if sum
of branch is 0 this means all branch is covered.
Following are the steps for algorithm
1) Selection: Selection operator selected individual by
probability. Selection is applied successfully until the test
generation is finished. This process is iterated until either
an optimal solution has found.
2) Cross over:-operator crossed too selected individual
basic chained by probability generation to new individual.
3) Mutation:-will mutate member of new individual
generation chain. The genetic algorithm search the input
domain of subject program fitness Function assigns non negative cost to each input value. The fitness function
plays a very important role in guiding GA/P to obtain the
best solutions within a large search space. Good fitness
functions will help GA/P to explore the search space
more effectively and efficiently. Bad fitness functions, on
the other hand, can easily make GA/P get trapped in a
local optimum solution and lose the discovery power.
REFERENCES
[1] J.H. Andrews, A. Groce, M. Weston, and R.G. Xu, “Random Test
Run Length and Effectiveness,” Proc. IEEE/ACM
Conf.Automated Software Eng., pp. 19-28, 2008.
Int’l
[2] A. Arcuri, “Full Theoretical Runtime Analysis of Alternating
Variable Method on the Triangle Classification Problem,” Search
Based Software Eng., pp. 113-121, 2009.
[3] A. Richard torkar, “Insight Knowledge in Search Based Software
Testing,” Proc. Genetic and Evolutionary Computation Conf., pp.
1649-1656,2009.
[4] A. Wasif Afzal “Theoretical Analysis of Local Search in Software
Testing,” Proc. Symp. Stochastic Algorithms, Foundations and
Applications, pp. 156-168, 2009.
[5] A. Robert fedult , “genetic algorithm and fitness function,” Proc.
IEEE Int’l Conf.
[6] Software Testing, Verification and Validation, pp. 205-214, 2010.
[7] A. Baresi and M Miraz “Evolutionary tes,” Proc. IEEE Int’l Conf.
Software Testing, Verification and Validation, pp. 469-478, 2009.
[8] Marinow and D. Notkin “white box with unit testing of Real-Time
Embedded Systems Using Random and Search-Based”pp.297307,2010
[9] P .McMinn “search based software test data generation”A survey of
software testing, verification and reliability,vol 14.2 pp 105156,2004
[10] S.KURSHID “Test i/p generation with java path
finder”vol12,pp2004
[11] Int’l Symp. Software Testing and Analysis, pp. 219-229, 2010.
[12] A. Arcuri, P. Lehre, and X. Yao, “Theoretical Runtime Analysis
in Search Based Software Engineering,” Technical Report CSR-0904,Univ. of Birmingham, 2009.
[13] A. Arcuri and X. Yao, “Search Based Software Testing of ObjectOriented Containers,” Information Sciences, vol. 178, no. 15, pp.
3075-3095, 2008.
Our experience applying GA and GP to ranking
function design and discovery suggests that the fitness
functions for information retrieval experiment should take
into account both the number of relevant documents and
the order in which they appear in the ranked list, which is
in line with the findings in (Lopez-Pujalte et al., 2003).
The following example illustrates this point. Suppose two
ranking functions both retrieve 5 relevant documents in
the top 10 results. Their relevance information (1 being
relevant and 0 being non-relevant) in the ranking list are
shown as follows:
Rank list 1 : 1 0 1 1 0 0 1 0 0 1
Rank list 2 : 1 1 0 1 1 1 0 0 0 0
If ranking order is ignored, the performance of the these
two rank lists is the same both returning 5 relevant
documents. However, we should prefer the second rank
list over the first because the second rank list presents
relevant documents sooner (i.e., has higher precision).
ISSUE 3 VOL 3 JUNE-JULY ICMSET 2014 PROCEEDINGS