Divide-by-Zero Exception Raising via Branch Coverage

  • Neelesh Bhattacharya
  • Abdelilah Sakti
  • Giuliano Antoniol
  • Yann-Gaël Guéhéneuc
  • Gilles Pesant
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6956)


In this paper, we discuss how a search-based branch coverage approach can be used to design an effective test data generation approach, specifically targeting divide-by-zero exceptions. We first propose a novel testability transformation combining approach level and branch distance. We then use different search strategies, i.e. hill climbing, simulated annealing, and genetic algorithm, to evaluate the performance of the novel testability transformation on a small synthetic example as well as on methods known to throw divide-by-zero exceptions, extracted from real world systems, namely Eclipse and Android. Finally, we also describe how the test data generation for divide-by-zero exceptions can be formulated as a constraint programming problem and compare the resolution of this problem with a genetic algorithm in terms of execution time. We thus report evidence that genetic algorithm using our novel testability transformation out-performs hill climbing and simulated annealing and a previous approach (in terms of numbers of fitness evaluation) but is out-performed by constraint programming (in terms of execution time).


Exception raising test input data generation evolutionary testing 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baresel, A.: Automatisierung von strukturtests mit evolutionren algorithmen. Diploma Thesis, Humboldt University, Berlin, Germany (2000)Google Scholar
  2. 2.
    Baresel, A., Sthamer, H., Schmidt, M.: Fitness function design to improve evolutionary structural testing. In: Proceedings of the Genetic and Evolutionary Computation Conference, pp. 1329–1336 (July 2002)Google Scholar
  3. 3.
    Chatterjee, R., Ryder, B.G.: Data-flow-based testing of object-oriented libraries. Tech. Rep. DCS-TR-382, Department of Computer Science, Rutgers University (1999)Google Scholar
  4. 4.
    Cohen, J.: Statistical power analysis for the behavioral sciences, 2nd edn. Lawrence Earlbaum Associates, Hillsdale (1988)zbMATHGoogle Scholar
  5. 5.
    Romano, D., Massimiliano Di Penta, G.A.: An approach for search based testing of null pointer exceptions. In: Proceedings of the Fourth International Conference on Software Testing, Verification and Validation, pp. 160–169 (March 2011)Google Scholar
  6. 6.
    Harman, M., Baresel, A., Binkley, D., Hierons, R.M., Hu, L., Korel, B., McMinn, P., Roper, M.: Testability transformation – program transformation to improve testability. In: Hierons, R.M., Bowen, J.P., Harman, M. (eds.) FORTEST. LNCS, vol. 4949, pp. 320–344. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  7. 7.
    Jo, J.W., Chang, B.M., Yi, K., Choe, K.M.: An uncaught exception analysis for java. Journal of System Software 72, 59–69 (2004), CrossRefGoogle Scholar
  8. 8.
    Joachim Wegener, A.B., Sthamer, H.: Evolutionary test environment for automatic structural testing. Information and Software Technology 43(14), 841–854 (2001)CrossRefGoogle Scholar
  9. 9.
    Jones, B., Sthamer, H., Eyres, D.: Automatic structural testing using genetic algorithms. Software Engineering Journal 11(5), 299–306 (1996)CrossRefGoogle Scholar
  10. 10.
    Korel, B.: Dynamic method of software test data generation. Softw. Test, Verif. Reliab. 2(4), 203–213 (1992)CrossRefGoogle Scholar
  11. 11.
    McMinn, P.: Search-based software test data generation: a survey. Software Testing Verification and Reliability 14(2), 105–156 (2004)CrossRefGoogle Scholar
  12. 12.
    Miller, W., Spooner, D.L.: Automatic generation of floating-point test data. IEEE Transactions on Software Engineering 2(3), 223–226 (1976)MathSciNetCrossRefGoogle Scholar
  13. 13.
    Mresa, E.S., Bottaci, L.: Efficiency of mutation operators and selective mutation strategies: An empirical study. Software Testing Verification and Reliability 9(4), 205–232 (1999)CrossRefGoogle Scholar
  14. 14.
    Pressman, R.S.: Software Engineering: A Practitioner’s Approach, 3rd edn. McGraw-Hill, New York (1992)zbMATHGoogle Scholar
  15. 15.
    Ryder, B.G., Smith, D.E., Kremer, U., Gordon, M.D., Shah, N.: A static study of java exceptions using JESP. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, pp. 67–81. Springer, Heidelberg (2000), CrossRefGoogle Scholar
  16. 16.
    Sakti, A., Guéhéneuc, Y.G., Pesant, G.: Cp-sst: approche basée sur la programmation par contraintes pour le test structurel du logiciel. Septitièmes Journées Francophones de Programmation par Contraintes (JFPC), 289–298 (June 2011)Google Scholar
  17. 17.
    Saurabh Sinha, R.O., Harrold, M.J.: Automated support for development, maintenance, and testing in the presence of implicit control flow. In: ICSE 2004, pp. 336–345. IEEE Computer Society Press, Washington, DC, USA (2004)Google Scholar
  18. 18.
    Tracey, N., Clark, J.A., Mander, K., McDermid, J.A.: Automated test-data generation for exception conditions. Software Practice and Experience 30(1), 61–79 (2000)CrossRefGoogle Scholar
  19. 19.
    Tracey, N., Clark, J.A., Mander, K.: Automated program flaw finding using simulated annealing. In: ISSTA, pp. 73–81 (1998)Google Scholar
  20. 20.
    Wegener, J., Baresel, A., Sthamer, H.: Evolutionary test environment for automatic structural testing. Information & Software Technology 43(14), 841–854 (2001)CrossRefGoogle Scholar
  21. 21.
    Wright, M.: Automating parameter choice for simulated annealing. Tech. Rep. 32, Lancaster University Management School, UK (2010)Google Scholar
  22. 22.
    Xanthakis, S., Ellis, C., Skourlas, C., Gall, A.L., Katsikas, S., Karapoulios, K.: Application des algorithmes genetiques au test des logiciels. In: 5th Int. Conference on Software Engineering and its Applications, pp. 625–636 (1992)Google Scholar
  23. 23.
    Zhang, B.T., Kim, J.J.: Comparison of selection methods for evolutionary optimization. Evolutionary Optimization 2(1), 55–70 (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Neelesh Bhattacharya
    • 1
  • Abdelilah Sakti
    • 1
  • Giuliano Antoniol
    • 1
  • Yann-Gaël Guéhéneuc
    • 1
  • Gilles Pesant
    • 1
  1. 1.Department of Computer and Software EngineeringÉcole Polytechnique de MontréalCanada

Personalised recommendations