Towards Generating Unit Test Codes Using Generative Adversarial Networks - Muhammad Johan Alibasa; Rizka Widyarini Purwanto; Yudi Priyadi; Rosa Reska Riskiana (Ikatan Ahli Informatika Indonesia (IAII), 2022)
Unit testing is one of the critical software development steps to ensure the software’s quality. Unit testing is often neglected despite its importance since it requires a significant amount of time and effort from the software developers to write them. Existing automated testing generating systems from past research still have shortcomings due to the limitations of the Genetic Algorithm (GA) in generating the appropriate unit test codes. This study explores the feasibility of using Generative Adversarial Networks (GAN) models to generate unit test code with the ability of GAN to cover GA’s drawbacks. We perform experimentations using four state-of-the-art GAN models to generate basic unit test codes and compare the results by analyzing the generated output codes using novel metrics proposed from past studies and performing a qualitative evaluation of the generated outputs. The results show that the generated codes have satisfactory quality scores (BLEU-2 of around 99%) from the models and adequate diversity scores (NLL-Div and NLL-Gen) in most models. Our study shows positive indications and potential in the use of GAN for automatic unit test code generation and suggests recommendations for future studies in GAN-based unit test code generation systems