Loading…

CasModaTest: A Cascaded and Model-agnostic Self-directed Framework for Unit Test Generation

Though many machine learning (ML)-based unit testing generation approaches have been proposed and indeed achieved remarkable performance, they still have several limitations in effectiveness and practical usage. More precisely, existing ML-based approaches (1) generate partial content of a unit test...

Full description

Saved in:
Bibliographic Details
Published in:arXiv.org 2024-06
Main Authors: Ni, Chao, Wang, Xiaoya, Chen, Liushan, Zhao, Dehai, Cai, Zhengong, Wang, Shaohua, Yang, Xiaohu
Format: Article
Language:English
Subjects:
Online Access:Get full text
Tags: Add Tag
No Tags, Be the first to tag this record!
cited_by
cites
container_end_page
container_issue
container_start_page
container_title arXiv.org
container_volume
creator Ni, Chao
Wang, Xiaoya
Chen, Liushan
Zhao, Dehai
Cai, Zhengong
Wang, Shaohua
Yang, Xiaohu
description Though many machine learning (ML)-based unit testing generation approaches have been proposed and indeed achieved remarkable performance, they still have several limitations in effectiveness and practical usage. More precisely, existing ML-based approaches (1) generate partial content of a unit test, mainly focusing on test oracle generation; (2) mismatch the test prefix with the test oracle semantically; and (3) are highly bound with the close-sourced model, eventually damaging data security. We propose CasModaTest, a cascaded, model-agnostic, and end-to-end unit test generation framework, to alleviate the above limitations with two cascaded stages: test prefix generation and test oracle generation. Then, we manually build large-scale demo pools to provide CasModaTest with high-quality test prefixes and test oracles examples. Finally, CasModaTest automatically assembles the generated test prefixes and test oracles and compiles or executes them to check their effectiveness, optionally appending with several attempts to fix the errors occurring in compiling and executing phases. To evaluate the effectiveness of CasModaTest, we conduct large-scale experiments on a widely used dataset (Defects4J) and compare it with four state-of-the-art (SOTA) approaches by considering two performance measures. The experimental results indicate that CasModaTest outperforms all SOTAs with a substantial improvement (i.e., 60.62%-352.55% in terms of accuracy, 2.83%-87.27% in terms of focal method coverage). Besides, we also conduct experiments of CasModaTest on different open-source LLMs and find that CasModaTest can also achieve significant improvements over SOTAs (39.82%-293.96% and 9.25%-98.95% in terms of accuracy and focal method coverage, respectively) in end-to-end unit test generation
format article
fullrecord <record><control><sourceid>proquest</sourceid><recordid>TN_cdi_proquest_journals_3072059767</recordid><sourceformat>XML</sourceformat><sourcesystem>PC</sourcesystem><sourcerecordid>3072059767</sourcerecordid><originalsourceid>FETCH-proquest_journals_30720597673</originalsourceid><addsrcrecordid>eNqNjLEKwjAURYMgWLT_8MC5EBPbqJsUq4uTOjmU0LxKak00SfH3jeAHOF0O53BHJGGcL7LVkrEJSb3vKKWsECzPeUKupfRHq-QZfdjAFiI2UqECaRREgX0mb8b6oBs4Yd9mSjtsQgwqJx_4tu4OrXVwMTrA9wT2aNDJoK2ZkXEre4_pb6dkXu3O5SF7OvsaYlt3dnAmqppTwWi-FoXg_1Uf1kNCHA</addsrcrecordid><sourcetype>Aggregation Database</sourcetype><iscdi>true</iscdi><recordtype>article</recordtype><pqid>3072059767</pqid></control><display><type>article</type><title>CasModaTest: A Cascaded and Model-agnostic Self-directed Framework for Unit Test Generation</title><source>Publicly Available Content Database</source><creator>Ni, Chao ; Wang, Xiaoya ; Chen, Liushan ; Zhao, Dehai ; Cai, Zhengong ; Wang, Shaohua ; Yang, Xiaohu</creator><creatorcontrib>Ni, Chao ; Wang, Xiaoya ; Chen, Liushan ; Zhao, Dehai ; Cai, Zhengong ; Wang, Shaohua ; Yang, Xiaohu</creatorcontrib><description>Though many machine learning (ML)-based unit testing generation approaches have been proposed and indeed achieved remarkable performance, they still have several limitations in effectiveness and practical usage. More precisely, existing ML-based approaches (1) generate partial content of a unit test, mainly focusing on test oracle generation; (2) mismatch the test prefix with the test oracle semantically; and (3) are highly bound with the close-sourced model, eventually damaging data security. We propose CasModaTest, a cascaded, model-agnostic, and end-to-end unit test generation framework, to alleviate the above limitations with two cascaded stages: test prefix generation and test oracle generation. Then, we manually build large-scale demo pools to provide CasModaTest with high-quality test prefixes and test oracles examples. Finally, CasModaTest automatically assembles the generated test prefixes and test oracles and compiles or executes them to check their effectiveness, optionally appending with several attempts to fix the errors occurring in compiling and executing phases. To evaluate the effectiveness of CasModaTest, we conduct large-scale experiments on a widely used dataset (Defects4J) and compare it with four state-of-the-art (SOTA) approaches by considering two performance measures. The experimental results indicate that CasModaTest outperforms all SOTAs with a substantial improvement (i.e., 60.62%-352.55% in terms of accuracy, 2.83%-87.27% in terms of focal method coverage). Besides, we also conduct experiments of CasModaTest on different open-source LLMs and find that CasModaTest can also achieve significant improvements over SOTAs (39.82%-293.96% and 9.25%-98.95% in terms of accuracy and focal method coverage, respectively) in end-to-end unit test generation</description><identifier>EISSN: 2331-8422</identifier><language>eng</language><publisher>Ithaca: Cornell University Library, arXiv.org</publisher><subject>Effectiveness ; Machine learning ; Performance evaluation</subject><ispartof>arXiv.org, 2024-06</ispartof><rights>2024. This work is published under http://arxiv.org/licenses/nonexclusive-distrib/1.0/ (the “License”). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.</rights><oa>free_for_read</oa><woscitedreferencessubscribed>false</woscitedreferencessubscribed></display><links><openurl>$$Topenurl_article</openurl><openurlfulltext>$$Topenurlfull_article</openurlfulltext><thumbnail>$$Tsyndetics_thumb_exl</thumbnail><linktohtml>$$Uhttps://www.proquest.com/docview/3072059767?pq-origsite=primo$$EHTML$$P50$$Gproquest$$Hfree_for_read</linktohtml><link.rule.ids>780,784,25753,37012,44590</link.rule.ids></links><search><creatorcontrib>Ni, Chao</creatorcontrib><creatorcontrib>Wang, Xiaoya</creatorcontrib><creatorcontrib>Chen, Liushan</creatorcontrib><creatorcontrib>Zhao, Dehai</creatorcontrib><creatorcontrib>Cai, Zhengong</creatorcontrib><creatorcontrib>Wang, Shaohua</creatorcontrib><creatorcontrib>Yang, Xiaohu</creatorcontrib><title>CasModaTest: A Cascaded and Model-agnostic Self-directed Framework for Unit Test Generation</title><title>arXiv.org</title><description>Though many machine learning (ML)-based unit testing generation approaches have been proposed and indeed achieved remarkable performance, they still have several limitations in effectiveness and practical usage. More precisely, existing ML-based approaches (1) generate partial content of a unit test, mainly focusing on test oracle generation; (2) mismatch the test prefix with the test oracle semantically; and (3) are highly bound with the close-sourced model, eventually damaging data security. We propose CasModaTest, a cascaded, model-agnostic, and end-to-end unit test generation framework, to alleviate the above limitations with two cascaded stages: test prefix generation and test oracle generation. Then, we manually build large-scale demo pools to provide CasModaTest with high-quality test prefixes and test oracles examples. Finally, CasModaTest automatically assembles the generated test prefixes and test oracles and compiles or executes them to check their effectiveness, optionally appending with several attempts to fix the errors occurring in compiling and executing phases. To evaluate the effectiveness of CasModaTest, we conduct large-scale experiments on a widely used dataset (Defects4J) and compare it with four state-of-the-art (SOTA) approaches by considering two performance measures. The experimental results indicate that CasModaTest outperforms all SOTAs with a substantial improvement (i.e., 60.62%-352.55% in terms of accuracy, 2.83%-87.27% in terms of focal method coverage). Besides, we also conduct experiments of CasModaTest on different open-source LLMs and find that CasModaTest can also achieve significant improvements over SOTAs (39.82%-293.96% and 9.25%-98.95% in terms of accuracy and focal method coverage, respectively) in end-to-end unit test generation</description><subject>Effectiveness</subject><subject>Machine learning</subject><subject>Performance evaluation</subject><issn>2331-8422</issn><fulltext>true</fulltext><rsrctype>article</rsrctype><creationdate>2024</creationdate><recordtype>article</recordtype><sourceid>PIMPY</sourceid><recordid>eNqNjLEKwjAURYMgWLT_8MC5EBPbqJsUq4uTOjmU0LxKak00SfH3jeAHOF0O53BHJGGcL7LVkrEJSb3vKKWsECzPeUKupfRHq-QZfdjAFiI2UqECaRREgX0mb8b6oBs4Yd9mSjtsQgwqJx_4tu4OrXVwMTrA9wT2aNDJoK2ZkXEre4_pb6dkXu3O5SF7OvsaYlt3dnAmqppTwWi-FoXg_1Uf1kNCHA</recordid><startdate>20240622</startdate><enddate>20240622</enddate><creator>Ni, Chao</creator><creator>Wang, Xiaoya</creator><creator>Chen, Liushan</creator><creator>Zhao, Dehai</creator><creator>Cai, Zhengong</creator><creator>Wang, Shaohua</creator><creator>Yang, Xiaohu</creator><general>Cornell University Library, arXiv.org</general><scope>8FE</scope><scope>8FG</scope><scope>ABJCF</scope><scope>ABUWG</scope><scope>AFKRA</scope><scope>AZQEC</scope><scope>BENPR</scope><scope>BGLVJ</scope><scope>CCPQU</scope><scope>DWQXO</scope><scope>HCIFZ</scope><scope>L6V</scope><scope>M7S</scope><scope>PIMPY</scope><scope>PQEST</scope><scope>PQQKQ</scope><scope>PQUKI</scope><scope>PRINS</scope><scope>PTHSS</scope></search><sort><creationdate>20240622</creationdate><title>CasModaTest: A Cascaded and Model-agnostic Self-directed Framework for Unit Test Generation</title><author>Ni, Chao ; Wang, Xiaoya ; Chen, Liushan ; Zhao, Dehai ; Cai, Zhengong ; Wang, Shaohua ; Yang, Xiaohu</author></sort><facets><frbrtype>5</frbrtype><frbrgroupid>cdi_FETCH-proquest_journals_30720597673</frbrgroupid><rsrctype>articles</rsrctype><prefilter>articles</prefilter><language>eng</language><creationdate>2024</creationdate><topic>Effectiveness</topic><topic>Machine learning</topic><topic>Performance evaluation</topic><toplevel>online_resources</toplevel><creatorcontrib>Ni, Chao</creatorcontrib><creatorcontrib>Wang, Xiaoya</creatorcontrib><creatorcontrib>Chen, Liushan</creatorcontrib><creatorcontrib>Zhao, Dehai</creatorcontrib><creatorcontrib>Cai, Zhengong</creatorcontrib><creatorcontrib>Wang, Shaohua</creatorcontrib><creatorcontrib>Yang, Xiaohu</creatorcontrib><collection>ProQuest SciTech Collection</collection><collection>ProQuest Technology Collection</collection><collection>Materials Science &amp; Engineering Collection</collection><collection>ProQuest Central (Alumni)</collection><collection>ProQuest Central</collection><collection>ProQuest Central Essentials</collection><collection>ProQuest Central</collection><collection>Technology Collection</collection><collection>ProQuest One Community College</collection><collection>ProQuest Central</collection><collection>SciTech Premium Collection</collection><collection>ProQuest Engineering Collection</collection><collection>Engineering Database</collection><collection>Publicly Available Content Database</collection><collection>ProQuest One Academic Eastern Edition (DO NOT USE)</collection><collection>ProQuest One Academic</collection><collection>ProQuest One Academic UKI Edition</collection><collection>ProQuest Central China</collection><collection>Engineering Collection</collection></facets><delivery><delcategory>Remote Search Resource</delcategory><fulltext>fulltext</fulltext></delivery><addata><au>Ni, Chao</au><au>Wang, Xiaoya</au><au>Chen, Liushan</au><au>Zhao, Dehai</au><au>Cai, Zhengong</au><au>Wang, Shaohua</au><au>Yang, Xiaohu</au><format>book</format><genre>document</genre><ristype>GEN</ristype><atitle>CasModaTest: A Cascaded and Model-agnostic Self-directed Framework for Unit Test Generation</atitle><jtitle>arXiv.org</jtitle><date>2024-06-22</date><risdate>2024</risdate><eissn>2331-8422</eissn><abstract>Though many machine learning (ML)-based unit testing generation approaches have been proposed and indeed achieved remarkable performance, they still have several limitations in effectiveness and practical usage. More precisely, existing ML-based approaches (1) generate partial content of a unit test, mainly focusing on test oracle generation; (2) mismatch the test prefix with the test oracle semantically; and (3) are highly bound with the close-sourced model, eventually damaging data security. We propose CasModaTest, a cascaded, model-agnostic, and end-to-end unit test generation framework, to alleviate the above limitations with two cascaded stages: test prefix generation and test oracle generation. Then, we manually build large-scale demo pools to provide CasModaTest with high-quality test prefixes and test oracles examples. Finally, CasModaTest automatically assembles the generated test prefixes and test oracles and compiles or executes them to check their effectiveness, optionally appending with several attempts to fix the errors occurring in compiling and executing phases. To evaluate the effectiveness of CasModaTest, we conduct large-scale experiments on a widely used dataset (Defects4J) and compare it with four state-of-the-art (SOTA) approaches by considering two performance measures. The experimental results indicate that CasModaTest outperforms all SOTAs with a substantial improvement (i.e., 60.62%-352.55% in terms of accuracy, 2.83%-87.27% in terms of focal method coverage). Besides, we also conduct experiments of CasModaTest on different open-source LLMs and find that CasModaTest can also achieve significant improvements over SOTAs (39.82%-293.96% and 9.25%-98.95% in terms of accuracy and focal method coverage, respectively) in end-to-end unit test generation</abstract><cop>Ithaca</cop><pub>Cornell University Library, arXiv.org</pub><oa>free_for_read</oa></addata></record>
fulltext fulltext
identifier EISSN: 2331-8422
ispartof arXiv.org, 2024-06
issn 2331-8422
language eng
recordid cdi_proquest_journals_3072059767
source Publicly Available Content Database
subjects Effectiveness
Machine learning
Performance evaluation
title CasModaTest: A Cascaded and Model-agnostic Self-directed Framework for Unit Test Generation
url http://sfxeu10.hosted.exlibrisgroup.com/loughborough?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2025-01-04T20%3A22%3A58IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Article-proquest&rft_val_fmt=info:ofi/fmt:kev:mtx:book&rft.genre=document&rft.atitle=CasModaTest:%20A%20Cascaded%20and%20Model-agnostic%20Self-directed%20Framework%20for%20Unit%20Test%20Generation&rft.jtitle=arXiv.org&rft.au=Ni,%20Chao&rft.date=2024-06-22&rft.eissn=2331-8422&rft_id=info:doi/&rft_dat=%3Cproquest%3E3072059767%3C/proquest%3E%3Cgrp_id%3Ecdi_FETCH-proquest_journals_30720597673%3C/grp_id%3E%3Coa%3E%3C/oa%3E%3Curl%3E%3C/url%3E&rft_id=info:oai/&rft_pqid=3072059767&rft_id=info:pmid/&rfr_iscdi=true