Towards Generating Unit Test Codes Using
Generative Adversarial Networks
Dublin Core
Title
Towards Generating Unit Test Codes Using
Generative Adversarial Networks
Generative Adversarial Networks
Subject
unit test, code generation, generative adversarial network
Description
Unit testing is one of the important software development steps to ensure the software’s quality. Despite its importance, unit
testing is often neglected 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 Genetic Algorithm (GA)
limitations to generate 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 as well as performing qualitative evaluation on 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 score (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 GANbased unit test code generation system
testing is often neglected 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 Genetic Algorithm (GA)
limitations to generate 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 as well as performing qualitative evaluation on 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 score (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 GANbased unit test code generation system
Creator
Muhammad Johan Alibasa1
, Rizka Widyarini Purwanto2
, Yudi Priyadi3
, Rosa Reska Riskiana4
, Rizka Widyarini Purwanto2
, Yudi Priyadi3
, Rosa Reska Riskiana4
Publisher
Telkom University
Date
: 29-04-2022
Contributor
Fajar bagus W
Format
PDF
Language
Indonesia
Type
Text
Files
Collection
Citation
Muhammad Johan Alibasa1
, Rizka Widyarini Purwanto2
, Yudi Priyadi3
, Rosa Reska Riskiana4, “Towards Generating Unit Test Codes Using
Generative Adversarial Networks,” Repository Horizon University Indonesia, accessed June 6, 2025, https://repository.horizon.ac.id/items/show/9157.
Generative Adversarial Networks,” Repository Horizon University Indonesia, accessed June 6, 2025, https://repository.horizon.ac.id/items/show/9157.