Skip to main content
Erschienen in: Neural Computing and Applications 1/2014

01.07.2014 | Original Article

Harmony search-based test data generation for branch coverage in software structural testing

verfasst von: Chengying Mao

Erschienen in: Neural Computing and Applications | Ausgabe 1/2014

Einloggen

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

Test data generation is always a key task in the field of software testing. In recent years, meta-heuristic search techniques have been considered as an effective way to assist test data generation in software structural testing. In this way, some representative test cases with high-coverage capability can be picked out from program input space. Harmony search (HS) is a recently developed algorithm and has been vigorously applied to various optimization problems. In the paper, we attempt to apply harmony search algorithm to generate test data satisfying branch coverage. At the preprocessing stage, the probes used for gathering coverage information are inserted into all branches via program static analysis. At the same time, the encoding and decoding styles between a test case and a harmony are also determined in advance. At the stage of test data searching, the subset of test data that has much stronger covering ability is stored in harmony memory. During the evolution process, one part of test suite is selected and adjusted from the harmony memory, and the other part is randomly generated from input space. Once a test suite is yielded after one-round search, its coverage can be measured by fitness function in our search algorithm. In our work, a new fitness function for branch coverage is constructed by comprehensively considering branch distance and branch weight. Here, the branch weight is determined by branch information in program, that is, the nesting level of a specific branch and the predicate types in it. Subsequently, the computed coverage metric is used for updating the test suite in the next round of searching. In order to validate the effectiveness of our proposed method, eight well-known programs are used for experimental evaluation. Experimental results show that the coverage of HS-based method is usually higher than those of other search algorithms, such as simulated annealing (SA) and genetic algorithm (GA). Meanwhile, HS demonstrates greater stability than SA and GA when varying the population size or performing repeated trials. That is to say, music-inspired HS algorithm is more suitable to generate test data for branch coverage in software structural testing.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Literatur
1.
Zurück zum Zitat Littlewood B, Strigini L (2000) Software reliability and dependability: a roadmap. In: Proceedings of the 22nd international conference on software engineering, future of software engineering track, pp 175–188, June Littlewood B, Strigini L (2000) Software reliability and dependability: a roadmap. In: Proceedings of the 22nd international conference on software engineering, future of software engineering track, pp 175–188, June
2.
Zurück zum Zitat Bertolino A (2007) Software testing research: achievements, challenges, dreams. In: Proceedings of the ICSE workshop on the future of software engineering (FOSE’07), pp 85–103, May Bertolino A (2007) Software testing research: achievements, challenges, dreams. In: Proceedings of the ICSE workshop on the future of software engineering (FOSE’07), pp 85–103, May
3.
Zurück zum Zitat Korel B (1992) Dynamic method for software test data generation. Softw Test Verif Reliab 2(4):203-213CrossRef Korel B (1992) Dynamic method for software test data generation. Softw Test Verif Reliab 2(4):203-213CrossRef
4.
Zurück zum Zitat Gupta N, Mathur AP, Soffa ML (1998) Automated test data generation using an iterative relaxation method. In: Proceedings of the SIGSOFT FSE’98, pp 231–244 Gupta N, Mathur AP, Soffa ML (1998) Automated test data generation using an iterative relaxation method. In: Proceedings of the SIGSOFT FSE’98, pp 231–244
5.
Zurück zum Zitat Offutt A, Jin Z, Pan J (1999) The dynamic domain reduction procedure for test data generation. Softw Pract Exp 29(2):167–193CrossRef Offutt A, Jin Z, Pan J (1999) The dynamic domain reduction procedure for test data generation. Softw Pract Exp 29(2):167–193CrossRef
6.
7.
Zurück zum Zitat Cadar C, Godefroid P, Khurshid S, Pǎsǎreanu CS, Sen K, Tillmann N, Visser W (2011) Symbolic execution for software testing in practice—preliminary assessment. In: Proceedings of the 33rd international conference on software engineering (ICSE’11), pp 1066–1071, May Cadar C, Godefroid P, Khurshid S, Pǎsǎreanu CS, Sen K, Tillmann N, Visser W (2011) Symbolic execution for software testing in practice—preliminary assessment. In: Proceedings of the 33rd international conference on software engineering (ICSE’11), pp 1066–1071, May
8.
Zurück zum Zitat Gotlieb A, Botella B, Rueher M (1998) Automatic test data generation using constraint solving techniques. In: Proceedings of the ISSTA’98, pp 53–62 Gotlieb A, Botella B, Rueher M (1998) Automatic test data generation using constraint solving techniques. In: Proceedings of the ISSTA’98, pp 53–62
9.
Zurück zum Zitat Edvardsson J, Kamkar M (2001) Analysis of the constraint solver in una based test data generation. In: Proceedings of the ESEC/FSE’01, pp 237–245 Edvardsson J, Kamkar M (2001) Analysis of the constraint solver in una based test data generation. In: Proceedings of the ESEC/FSE’01, pp 237–245
10.
Zurück zum Zitat Zhang J, Xu C, Wang X (2004) Path-oriented test data generation using symbolic execution and constraint solving techniques. In: Proceedings of the international conference on software engineering and formal methods, pp 242–250 Zhang J, Xu C, Wang X (2004) Path-oriented test data generation using symbolic execution and constraint solving techniques. In: Proceedings of the international conference on software engineering and formal methods, pp 242–250
11.
Zurück zum Zitat Ge X, Taneja K, Xie T, Tillmann N (2011) Dyta: dynamic symbolic execution guided with static verification results. In: Proceedings of the ICSE’11, pp 992–994 Ge X, Taneja K, Xie T, Tillmann N (2011) Dyta: dynamic symbolic execution guided with static verification results. In: Proceedings of the ICSE’11, pp 992–994
12.
Zurück zum Zitat McMinn P (2004) Search-based software test data generation: a survey. Soft Test Verif Reliab 14:105–156CrossRef McMinn P (2004) Search-based software test data generation: a survey. Soft Test Verif Reliab 14:105–156CrossRef
13.
Zurück zum Zitat McMinn P (2011) Search-based software testing: past, present and future. In: Proceedings of ICSE workshop on the search-based software testing (SBST’11), pp 153–163 McMinn P (2011) Search-based software testing: past, present and future. In: Proceedings of ICSE workshop on the search-based software testing (SBST’11), pp 153–163
14.
Zurück zum Zitat Tracey N, Clark J, Mander K, McDermid J (1998) An automated framework for structural test-data generation. In: Proceedings of the 13th international conference on automated software engineering (ASE’98), pp 285–288 Tracey N, Clark J, Mander K, McDermid J (1998) An automated framework for structural test-data generation. In: Proceedings of the 13th international conference on automated software engineering (ASE’98), pp 285–288
15.
Zurück zum Zitat Ayari K, Bouktif S, Antoniol G (2007) Automatic mutation test input data generation via ant colony. In: Proceedings of the 9th annual conference on genetic and evolutionary computation (GECCO’07), pp 1074–1081 Ayari K, Bouktif S, Antoniol G (2007) Automatic mutation test input data generation via ant colony. In: Proceedings of the 9th annual conference on genetic and evolutionary computation (GECCO’07), pp 1074–1081
16.
Zurück zum Zitat Sthamer HH (1995) The automatic generation of software test data using genetic algorithms, PhD thesis. University of Glamorgan, November Sthamer HH (1995) The automatic generation of software test data using genetic algorithms, PhD thesis. University of Glamorgan, November
17.
Zurück zum Zitat Jones BF, Sthamer HH, Eyres DE (1996) Automated structural testing using genetic algorithms. Softw Eng J 11(5):299–306CrossRef Jones BF, Sthamer HH, Eyres DE (1996) Automated structural testing using genetic algorithms. Softw Eng J 11(5):299–306CrossRef
18.
Zurück zum Zitat Pargas RP, Harrold MJ, Peck R (1999) Automated structural testing using genetic algorithms. Softw Test Verif Reliab 9(4):263–282CrossRef Pargas RP, Harrold MJ, Peck R (1999) Automated structural testing using genetic algorithms. Softw Test Verif Reliab 9(4):263–282CrossRef
19.
Zurück zum Zitat Harman M, McMinn P (2010) A theoretical and empirical study of search-based testing: local, global, and hybrid search. IEEE Trans Softw Eng 36(2):226–247CrossRef Harman M, McMinn P (2010) A theoretical and empirical study of search-based testing: local, global, and hybrid search. IEEE Trans Softw Eng 36(2):226–247CrossRef
20.
Zurück zum Zitat Geem ZM, Kim J, Loganathan G (2001) A new heuristic optimization algorithm: harmony search. Simulation 76(2):60–68CrossRef Geem ZM, Kim J, Loganathan G (2001) A new heuristic optimization algorithm: harmony search. Simulation 76(2):60–68CrossRef
21.
Zurück zum Zitat Geem ZM (2009) Music-inspired harmony search algorithm: theory and applications. Springer, BerlinCrossRef Geem ZM (2009) Music-inspired harmony search algorithm: theory and applications. Springer, BerlinCrossRef
22.
Zurück zum Zitat Ammann P, Offutt J (2008) Introduction to software testing. Cambridge University Press, LondonCrossRefMATH Ammann P, Offutt J (2008) Introduction to software testing. Cambridge University Press, LondonCrossRefMATH
23.
Zurück zum Zitat Zhu H, Hall PAV, May JHR (1997) Software unit test coverage and adequacy. ACM Comput Surv 29(4):366-427CrossRef Zhu H, Hall PAV, May JHR (1997) Software unit test coverage and adequacy. ACM Comput Surv 29(4):366-427CrossRef
24.
Zurück zum Zitat Mao C (2013) Structural test data generation based on harmony search. In: Proceedings of the 4th international conference on international conference on swarm intelligence (ICSI’13), pp 353–360, June Mao C (2013) Structural test data generation based on harmony search. In: Proceedings of the 4th international conference on international conference on swarm intelligence (ICSI’13), pp 353–360, June
25.
26.
Zurück zum Zitat Michael CC, McGraw GE, Schatz MA, Walton CC (1997) Genetic algorithms for dynamic test data generations. Technical Report RSTR-003-97-11, May Michael CC, McGraw GE, Schatz MA, Walton CC (1997) Genetic algorithms for dynamic test data generations. Technical Report RSTR-003-97-11, May
27.
Zurück zum Zitat Korel B (1990) Automated software test data generation. IEEE Trans Softw Eng 16(8):870–879CrossRef Korel B (1990) Automated software test data generation. IEEE Trans Softw Eng 16(8):870–879CrossRef
28.
Zurück zum Zitat Harman M, Hu L, Hierons R, Wegener J, Sthamer H, Baresel A, Roper M (2004) Testability transformation. IEEE Trans Softw Eng 30(1):3–16CrossRef Harman M, Hu L, Hierons R, Wegener J, Sthamer H, Baresel A, Roper M (2004) Testability transformation. IEEE Trans Softw Eng 30(1):3–16CrossRef
29.
Zurück zum Zitat Gong D, Yao X (2012) Testability transformation based on equivalence of target statements. Neural Comput Appl 21(8):1871–1882CrossRef Gong D, Yao X (2012) Testability transformation based on equivalence of target statements. Neural Comput Appl 21(8):1871–1882CrossRef
31.
Zurück zum Zitat Cohen MB, Colbourn CJ, Ling ACH (2003) Augmenting simulated annealing to build interaction test suites. In: Proceedings of the 14th international symposium on software reliability engineering (ISSRE’03), pp 394–405 Cohen MB, Colbourn CJ, Ling ACH (2003) Augmenting simulated annealing to build interaction test suites. In: Proceedings of the 14th international symposium on software reliability engineering (ISSRE’03), pp 394–405
32.
Zurück zum Zitat Shi Y, Eberhart RC (1998) A modified particle swarm optimizer. In: Proceedings of the 1998 IEEE international conference on evolutionary computation (ICEC’98), pp 69–73 Shi Y, Eberhart RC (1998) A modified particle swarm optimizer. In: Proceedings of the 1998 IEEE international conference on evolutionary computation (ICEC’98), pp 69–73
33.
Zurück zum Zitat Windisch A, Wappler S, Wegener J (2007) Applying particle swarm optimization to software testing. In: Proceedings of the 9th annual conference on genetic and evolutionary computation (GECCO’07), pp 1121–1128 Windisch A, Wappler S, Wegener J (2007) Applying particle swarm optimization to software testing. In: Proceedings of the 9th annual conference on genetic and evolutionary computation (GECCO’07), pp 1121–1128
34.
Zurück zum Zitat Li H, Lam CP (2005) An ant colony optimization approach to test sequence generation for state-based software testing. In: Proceedings of the 5th international conference on quality software (QSIC’05), pp 255–264 Li H, Lam CP (2005) An ant colony optimization approach to test sequence generation for state-based software testing. In: Proceedings of the 5th international conference on quality software (QSIC’05), pp 255–264
35.
Zurück zum Zitat Sagarna R, Arcuri A, Yao X (2007) Estimation of distribution algorithms for testing object oriented software. In: Proceedings of the IEEE congress on evolutionary computation (CEC’07), pp 438–444, September Sagarna R, Arcuri A, Yao X (2007) Estimation of distribution algorithms for testing object oriented software. In: Proceedings of the IEEE congress on evolutionary computation (CEC’07), pp 438–444, September
36.
Zurück zum Zitat Bouchachia A (2007) An immune genetic algorithm for software test data generation. In: Proceedings of the 7th international conference on hybrid intelligent systems (HIS’07), pp 84–89 Bouchachia A (2007) An immune genetic algorithm for software test data generation. In: Proceedings of the 7th international conference on hybrid intelligent systems (HIS’07), pp 84–89
37.
Zurück zum Zitat Zou D, Gao L, Li S, Wu J, Wang X (2010) A novel global harmony search algorithm for task assignment problem. J Syst Softw 83:1678–1688CrossRef Zou D, Gao L, Li S, Wu J, Wang X (2010) A novel global harmony search algorithm for task assignment problem. J Syst Softw 83:1678–1688CrossRef
38.
Zurück zum Zitat Mahdavi M, Abolhassani H (2009) Harmony k-means algorithm for document clustering. Data Min Knowl Discov 18:370–391CrossRefMathSciNet Mahdavi M, Abolhassani H (2009) Harmony k-means algorithm for document clustering. Data Min Knowl Discov 18:370–391CrossRefMathSciNet
39.
Zurück zum Zitat Forsati R, Mahdavi M (2010) Web text mining using harmony search. In: Geem ZW (ed) Recent advances in harmony search algorithm. Springer, Berlin Forsati R, Mahdavi M (2010) Web text mining using harmony search. In: Geem ZW (ed) Recent advances in harmony search algorithm. Springer, Berlin
40.
Zurück zum Zitat Karimi Z, Abolhassani H, Beigy H (2012) A new method of mining data streams using harmony search. J Intell Inf Syst 39(2):491–511CrossRef Karimi Z, Abolhassani H, Beigy H (2012) A new method of mining data streams using harmony search. J Intell Inf Syst 39(2):491–511CrossRef
41.
Zurück zum Zitat Jafarpour N, Khayyambashi M-R (2012) Qos-aware selection of web service compositions using harmony search algorithm. J Digit Inf Manage 8(3):160–166 Jafarpour N, Khayyambashi M-R (2012) Qos-aware selection of web service compositions using harmony search algorithm. J Digit Inf Manage 8(3):160–166
42.
Zurück zum Zitat Rahman A, Alsewari A, Zamli KZ (2012) Design and implementation of a harmony-search-based variable-strength t-way testing strategy with constraints support. Inf Softw Technol 54(6):553–568CrossRef Rahman A, Alsewari A, Zamli KZ (2012) Design and implementation of a harmony-search-based variable-strength t-way testing strategy with constraints support. Inf Softw Technol 54(6):553–568CrossRef
43.
Zurück zum Zitat Yang X-S (2009) Harmony search as a metaheuristic algorithm. In: Geem ZW (eds) Music-inspired harmony search algorithm: theory and applications. Springer, Berlin Yang X-S (2009) Harmony search as a metaheuristic algorithm. In: Geem ZW (eds) Music-inspired harmony search algorithm: theory and applications. Springer, Berlin
44.
Zurück zum Zitat Bertolino A, Mirandola R, Peciola E (1997) A case study in branch testing automation. J Syst Softw 38(1):47–59CrossRef Bertolino A, Mirandola R, Peciola E (1997) A case study in branch testing automation. J Syst Softw 38(1):47–59CrossRef
45.
Zurück zum Zitat Wegener J, Baresel A, Sthamer H (2001) Evolutionary test environment for automatic structural testing. Inf Softw Technol 43(14):841–854CrossRef Wegener J, Baresel A, Sthamer H (2001) Evolutionary test environment for automatic structural testing. Inf Softw Technol 43(14):841–854CrossRef
46.
Zurück zum Zitat Liu X, Liu H, Wang B, Chen P, Cai X (2005) A unified fitness function calculation rule for flag conditions to improve evolutionary testing. In: Proceedings of the 20th IEEE/ACM international conference on automated software engineering (ASE’05), pp 337–341, November Liu X, Liu H, Wang B, Chen P, Cai X (2005) A unified fitness function calculation rule for flag conditions to improve evolutionary testing. In: Proceedings of the 20th IEEE/ACM international conference on automated software engineering (ASE’05), pp 337–341, November
47.
Zurück zum Zitat Wang Y (2002) On cognitive informatics. In: Proceedings of the 1st IEEE international conference on cognitive informatics, pp 34–42, August Wang Y (2002) On cognitive informatics. In: Proceedings of the 1st IEEE international conference on cognitive informatics, pp 34–42, August
48.
Zurück zum Zitat Alba E, Chicano F (2008) Observations in using parallel and sequential evolutionary algorithms for automatic software testing. Comput Oper Res 35:3161–3183CrossRefMATH Alba E, Chicano F (2008) Observations in using parallel and sequential evolutionary algorithms for automatic software testing. Comput Oper Res 35:3161–3183CrossRefMATH
49.
Zurück zum Zitat Ferrer J, Chicano F, Alba E (2012) Evolutionary algorithms for the multi-objective test data generation problem. Softw Pract Exp 42(11):1331–1362 Ferrer J, Chicano F, Alba E (2012) Evolutionary algorithms for the multi-objective test data generation problem. Softw Pract Exp 42(11):1331–1362
50.
Zurück zum Zitat Liang YD (2011) Introduction to Java Programming eighth edition. Pearson Education Inc., Upper Saddle River, NJ Liang YD (2011) Introduction to Java Programming eighth edition. Pearson Education Inc., Upper Saddle River, NJ
Metadaten
Titel
Harmony search-based test data generation for branch coverage in software structural testing
verfasst von
Chengying Mao
Publikationsdatum
01.07.2014
Verlag
Springer London
Erschienen in
Neural Computing and Applications / Ausgabe 1/2014
Print ISSN: 0941-0643
Elektronische ISSN: 1433-3058
DOI
https://doi.org/10.1007/s00521-013-1474-z

Weitere Artikel der Ausgabe 1/2014

Neural Computing and Applications 1/2014 Zur Ausgabe

Premium Partner