A3Test: Assertion-Augmented Automated Test case generation

被引:8
作者
Alagarsamy, Saranya [1 ]
Tantithamthavorn, Chakkrit [1 ]
Aleti, Aldeida [1 ]
机构
[1] Monash Univ, Melbourne, Australia
基金
澳大利亚研究理事会;
关键词
Test case generation; Deep learning;
D O I
10.1016/j.infsof.2024.107565
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Context: Test case generation is a critical yet challenging task in software development. Recently, AthenaTest - a Deep Learning (DL) approach for generating unit test cases has been proposed. However, our revisiting study reveals that AthenaTest can generate less than one-fifth of the test cases correctly, due to a lack of assertion knowledge and test signature verification. Objective: This paper introduces A3Test, a novel DL-based approach to the generation of test cases, enhanced with assertion knowledge and a mechanism to verify consistency of the name and signatures of the tests. A3Test aims to adapt domain knowledge from assertion generation to test case generation. Method: A3Test employs domain adaptation principles and introduces a verification approach to name consistency and test signatures. We evaluate its effectiveness using 5,278 focal methods from the Defects4j dataset. Results: Our findings indicate that A3Test outperforms AthenaTest and ChatUniTest. A3Test generates 2.16% to 395.43% more correct test cases, achieves 2.17% to 34.29% higher method coverage, and 25.64% higher line coverage. A3Test achieves 2.13% to 12.20% higher branch coverage, 2.22% to 12.20% higher mutation scores, and 2.44% to 55.56% more correct assertions compared to both ChatUniTest and AthenaTest respectively for one iteration. When generating multiple test cases per method A3Test still shows improvements and comparable efficacy to ChatUnitTest. A survey of developers reveals that the majority of the participants 70.51% agree that test cases generated by A3Test are more readable than those generated by EvoSuite. Conclusions: A3Test significantly enhances test case generation through its incorporation of assertion knowledge and test signature verification, contributing to the generation of correct test cases.
引用
收藏
页数:15
相关论文
共 37 条
[1]  
Agency, 2022, About us
[2]  
Ahmad WU, 2021, 2021 CONFERENCE OF THE NORTH AMERICAN CHAPTER OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS: HUMAN LANGUAGE TECHNOLOGIES (NAACL-HLT 2021), P2655
[3]   An Industrial Evaluation of Unit Test Generation: Finding Real Faults in a Financial Application [J].
Almasi, M. Moein ;
Hemmati, Hadi ;
Fraser, Gordon ;
Arcuri, Andrea ;
Benefelds, Janis .
2017 IEEE/ACM 39TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING: SOFTWARE ENGINEERING IN PRACTICE TRACK (ICSE-SEIP 2017), 2017, :263-272
[4]  
[Anonymous], 2019, Java Code Coverage Library
[5]  
[Anonymous], 2010, Succeeding with Agile: Software Development Using Scrum
[6]  
[Anonymous], 2019, Google Gson
[7]  
[Anonymous], 2018, JUnit 5
[8]  
Apache Common Lang, 2022, About us
[9]  
Apache Commons CLI, 2022, About us
[10]  
Chen YH, 2024, Arxiv, DOI [arXiv:2305.04764, DOI 10.48550/ARXIV.2305.04764]