📄 066-068.html
字号:
<HTML>
<HEAD>
<META name=vsisbn content="0849398010">
<META name=vstitle content="Industrial Applications of Genetic Algorithms">
<META name=vsauthor content="Charles Karr; L. Michael Freeman">
<META name=vsimprint content="CRC Press">
<META name=vspublisher content="CRC Press LLC">
<META name=vspubdate content="12/01/98">
<META name=vscategory content="Web and Software Development: Artificial Intelligence: Other">
<TITLE>Industrial Applications of Genetic Algorithms:Software Test Data Generation from a Genetic Algorithm</TITLE>
<!-- HEADER -->
<STYLE type="text/css">
<!--
A:hover {
color : Red;
}
-->
</STYLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<!--ISBN=0849398010//-->
<!--TITLE=Industrial Applications of Genetic Algorithms//-->
<!--AUTHOR=Charles Karr//-->
<!--AUTHOR=L. Michael Freeman//-->
<!--PUBLISHER=CRC Press LLC//-->
<!--IMPRINT=CRC Press//-->
<!--CHAPTER=4//-->
<!--PAGES=066-068//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="063-066.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch05/069-071.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
</P>
<P>A mutation rate of 0.005 was beneficial. Larger rates were disruptive, while lower rates were less effective. The probability of crossover was set to 1.0, meaning that selected individuals always crossed. This also helped achieve convergence sooner.
</P>
<P>The GA was highly susceptible to selection noise. Meaningful results were only obtained after using stochastic remainder sampling and multipoint crossover (two points over a 24-bit chromosome).</P>
<P>Figure 4.6 is a histogram depicting the number of times each of the eighteen possible blocks of code was executed by both fitness algorithms at generation 50. The data used to produce Figure 4.6 was obtained from GA runs with a population multiplier of 14. This allowed both fitness algorithms to converge well before generation 50. With this large multiplier value both algorithms perform similarly in terms of speed of convergence. However, the histogram shows that the IPP fitness algorithm executed nodes 80 and 88 (columns 14 and 15 in Figure 4.6) more frequently than the LBTPB algorithm. Node 80 is the block of code entered by the default else statement on line 78 (Figure 4.1). Node 88 is a block of code (beginning on line 86) executed when the function’s input parameters do not form a triangle. The LBTPB algorithm produces more sets of test data forming equilateral, isosceles, and scalene triangles (nodes 95, 102, and 108). The LBTPB algorithm distributes test cases more evenly over the four possible outputs (not a triangle, equilateral, isosceles, and scalene).</P>
<P><A NAME="Fig9"></A><A HREF="javascript:displayWindow('images/04-09.jpg',500,348)"><IMG SRC="images/04-09t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/04-09.jpg',500,348)"><FONT COLOR="#000077"><B>Figure 4.6</B></FONT></A> Distribution of test cases over the 18 code blocks in trityp-easy.</P>
<P><FONT SIZE="+1"><B>FUTURE WORK</B></FONT></P>
<P>This chapter describes the use of Goldberg’s SGA with the reproduction, crossover, and mutation operators. There are other operators that should prove helpful to this work. These include marriage restriction and sharing to help create species of test data.
</P>
<P>As mentioned earlier, a C language parser is required to produce the test data generator utility. Codings appropriate for other elements of the C language need to be developed (enumerated types, arrays, pointers, etc.). Some of the authors cited earlier have begun work in this area. Inclusion of their findings in the proposed utility may prove beneficial.</P>
<P>The LBTPB fitness function is a special case of a more general algorithm which considers unique nodes all along the thread of execution. This general case algorithm needs to be developed further and evaluated.</P>
<P>One goal of testing is to minimize the number of test cases required. The work described here creates stable sub-populations of redundant test cases. To minimize tester time, a method is needed to take the set of test data produced and find the minimum number of members that provide 100% line coverage. This problem is similar in nature to the Traveling Salesman problem and should be solvable with a second genetic algorithm performing a pure minimization.</P>
<P><FONT SIZE="+1"><B>CONCLUSIONS</B></FONT></P>
<P>Genetic algorithms are useful tools for generating sets of unit test provided certain conditions are met. These include using a sufficiently large population size to allow a stable and optimal population of test cases to form at the end of the run. A population size of ten times the McCabe cyclometric complexity is recommended.
</P>
<P>The LBTPB fitness algorithm helps the GA converge sooner and distributes test cases more evenly over the module under test than the IPP fitness algorithm. Both fitness functions tested eventually converge given an adequate population size. The LBTPB fitness algorithm accomplishes this by rewarding test cases executing unique code.</P>
<P>A small bonus value aids convergence. Large bonus values are disruptive. This work suggests that a bonus of 5 fitness points helps the genetic algorithm search for better test cases without causing loss of coverage due to overzealous replacement.</P>
<P><FONT SIZE="+1"><B>REFERENCES</B></FONT></P>
<DL>
<DD><B>1</B> H. H. Sthamer, B. F. Jones, and D. E. Eyers (1994). Generating test data for ADA generic procedures using genetic algorithms. <I>Proceedings of ACEDC 1994</I>, 134-140, Plymouth, UK: University of Plymouth.
<DD><B>2</B> S. Xanthakis, C. Ellis, C. Skourlas, A. LeGall, S. Katsikas, and K. Karapoulios (1992). Application of genetic algorithms to software testing. <I>Proceedings of the 5th International Conference on Software Engineering</I>, 625-636, Toulouse, France.
<DD><B>3</B> A. L. Watkins (1995). The automatic generation of test data using genetic algorithms. In I. M. Marshall, W. B. Samson, and D. G. Edgar-Nevill (Eds.) <I>Proceedings of the 4th Software Quality Conference</I>, <B>2</B>, 300-309, Dundee, UK.
<DD><B>4</B> D. E. Goldberg (1989). <I>Genetic algorithms in search, optimization, and machine learning</I>. Reading, MA: Addison-Wesley Publishing Company, Inc.
<DD><B>5</B> T. McCabe (1976). A complexity measure. <I>IEEE Trans. on Software Engineering</I>, <B>SE –2</B> (4), 308-320.
</DL>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="063-066.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch05/069-071.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<hr width="90%" size="1" noshade>
<div align="center">
<font face="Verdana,sans-serif" size="1">Copyright © <a href="/reference/crc00001.html">CRC Press LLC</a></font>
</div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
</BODY>
</HTML>
<!-- END FOOTER -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -