Javaテストコードの再利用による自動生成に向けた移植可能なテストメソッドの調査

Search this article

Abstract

ソフトウェアの品質を高く保つため,ソフトウェアテストがさかんに行われている.テストコードを用いた自動テストは,テスト実行の労力を軽減するが,テストコードの作成には労力が必要となる.既存のテストコード自動生成技術は,入力として何らかの文書を必要とするか,でなければ非常に単純な単体テストのみしか作成できない.一方,既存のテストコードを再利用することで,使用されていた実績があり人手で作られたものに近い高品質なテストコードを手軽に生成できる可能性がある.我々は新たなJavaテストコード自動生成技術の開発に向け,その第1歩として,あるテストメソッドを実行可能性を保ちつつ自動的に移植する手法およびそれが可能となる条件を構想した.さらにオープンソースのJavaプロジェクトを調査し,テストコードの再利用元として使用できるリポジトリが1,862件存在することや,大半のテストメソッドはテスト対象コードにたかだか2つの依存を持つこと,そうした依存関係を保つ移植によって本来必要なテストメソッドの平均83%を生成できる可能性を実証的に示し,既存テストコードの再利用による自動生成手法が現実的かつ有益であることを示した.

Software developers test their software products. Automated testing with test codes lightens their efforts to test. However, writing appropriate test codes manually is difficult and a time-consuming activity. Several existing automatically create test codes techniques require to prepare some documents, otherwise, they can create only very simple unit tests. Reusing existing test code may easily generate high-quality test code. Toward the technique, we propose the transplantable condition for that a test method can keep its feasibility after transplanting. We investigate open source Java projects in GitHub. As the results, we have shown that there are available 1,862 repositories with test codes, and that most test methods have at most 2 dependencies on the code under test. We have empirically demonstrated the possibility that porting that maintains such dependencies can generate an average of 83% of the originally needed test methods. From the results, an automatic generation method by reusing existing test code is realistic and useful.

Journal

Related Projects

See more

Details 詳細情報について

Report a problem

Back to top