Domain Adaptation for Deep Unit Test Case Generation

要約

最近、単体テスト ケースの生成を自動化するために、深層学習ベースのテスト ケース生成アプローチが提案されています。
この調査では、Transformer ベースのコード モデルを利用して、プロジェクト レベルでドメイン アダプテーション (DA) を利用して単体テストを生成します。
具体的には、ソース コード データでトレーニングされた比較的小さな言語モデルである CodeT5 を使用し、テスト生成タスクで微調整します。
次に、対象プロジェクト データごとにさらに微調整して、プロジェクト固有の知識 (プロジェクト レベル DA) を学習します。
Methods2test データセットを使用してテスト生成タスク用に CodeT5 を微調整し、プロジェクト レベルのドメインの適応と評価用に Defects4j データセットを使用します。
Defects4j データセットの 5 つのプロジェクトについて、(a) DA なしのテスト生成で微調整された CodeT5、(b) A3Test ツール、および (c) GPT-4 とアプローチを比較します。
結果は、DA を使用すると、生成されたテストのライン カバレッジを、上記の (a)、(b)、および (c) のベースラインと比較して、それぞれ平均 18.62%、19.88%、および 18.02% 増加できることを示しています。
結果は、BLEU や CodeBLEU などの他の指標を使用した場合も一貫して改善を示しています。
さらに、私たちのアプローチは、EvoSuite などの既存の検索ベースのテスト生成ツールと並んで補完的なソリューションと見なすことができ、全体のカバレッジと変異スコアを平均 34.42% と 6.8% (ライン カバレッジと変異については 6.8%) 向上させることができることを示します。
それぞれスコア。

要約(オリジナル)

Recently, deep learning-based test case generation approaches have been proposed to automate the generation of unit test cases. In this study, we leverage Transformer-based code models to generate unit tests with the help of Domain Adaptation (DA) at a project level. Specifically, we use CodeT5, which is a relatively small language model trained on source code data, and fine-tune it on the test generation task; then again further fine-tune it on each target project data to learn the project-specific knowledge (project-level DA). We use the Methods2test dataset to fine-tune CodeT5 for the test generation task and the Defects4j dataset for project-level domain adaptation and evaluation. We compare our approach with (a) CodeT5 fine-tuned on the test generation without DA, (b) the A3Test tool, and (c) GPT-4, on 5 projects from the Defects4j dataset. The results show that using DA can increase the line coverage of the generated tests on average 18.62%, 19.88%, and 18.02% compared to the above (a), (b), and (c) baselines, respectively. The results also consistently show improvements using other metrics such as BLEU and CodeBLEU. In addition, we show that our approach can be seen as a complementary solution alongside existing search-based test generation tools such as EvoSuite, to increase the overall coverage and mutation scores with an average of 34.42% and 6.8%, for line coverage and mutation score, respectively.

arxiv情報

著者 Jiho Shin,Sepehr Hashtroudi,Hadi Hemmati,Song Wang
発行日 2024-01-19 15:58:34+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.SE パーマリンク