要約
大規模な言語モデル(LLM)を使用して、Javaメソッドの単体テスト生成を自動化するための新しいアプローチについて説明します。
既存のLLMベースのアプローチは、テストする方法(焦点方法)のサンプル使用法に依存しており、焦点メソッドのクラス全体を入力プロンプトとコンテキストとして提供します。
前者のアプローチは、特に新たに書かれた焦点方法のために、サンプルの使用が不足しているため、しばしば実行可能ではありません。
後者のアプローチは十分にスケーリングしません。
焦点法と関連するクラスの複雑さが大きいほど、適切なテストコードを作成することはより困難です(基礎となるLLMのプロンプトとコンテキストの長さを超えるなどの要因のため)。
焦点分析によって取得されたプログラム分析%で得られた\ emph {concise}および\ emph {precise}コンテキスト情報を使用してプロンプトを増やすと、LLMを介して単体テストコードを生成する有効性が向上することを示します。
大規模な商用Javaプロジェクトと人気のあるオープンソースJavaプロジェクトでのアプローチを検証します。
要約(オリジナル)
We describe a novel approach to automating unit test generation for Java methods using large language models (LLMs). Existing LLM-based approaches rely on sample usage(s) of the method to test (focal method) and/or provide the entire class of the focal method as input prompt and context. The former approach is often not viable due to the lack of sample usages, especially for newly written focal methods. The latter approach does not scale well enough; the bigger the complexity of the focal method and larger associated class, the harder it is to produce adequate test code (due to factors such as exceeding the prompt and context lengths of the underlying LLM). We show that augmenting prompts with \emph{concise} and \emph{precise} context information obtained by program analysis %of the focal method increases the effectiveness of generating unit test code through LLMs. We validate our approach on a large commercial Java project and a popular open-source Java project.
arxiv情報
著者 | Sujoy Roychowdhury,Giriprasad Sridhara,A K Raghavan,Joy Bose,Sourav Mazumdar,Hamender Singh,Srinivasan Bajji Sugumaran,Ricardo Britto |
発行日 | 2025-03-07 13:09:37+00:00 |
arxivサイト | arxiv_id(pdf) |
提供元, 利用サービス
arxiv.jp, Google