Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Deljouyi, Amirhossein, Koohestani, Roham, Izadi, Maliheh, Zaidman, Andy
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910572037013504
author Deljouyi, Amirhossein
Koohestani, Roham
Izadi, Maliheh
Zaidman, Andy
author_facet Deljouyi, Amirhossein
Koohestani, Roham
Izadi, Maliheh
Zaidman, Andy
contents Automated unit test generators, particularly search-based software testing tools like EvoSuite, are capable of generating tests with high coverage. Although these generators alleviate the burden of writing unit tests, they often pose challenges for software engineers in terms of understanding the generated tests. To address this, we introduce UTGen, which combines search-based software testing and large language models to enhance the understandability of automatically generated test cases. We achieve this enhancement through contextualizing test data, improving identifier naming, and adding descriptive comments. Through a controlled experiment with 32 participants from both academia and industry, we investigate how the understandability of unit tests affects a software engineer's ability to perform bug-fixing tasks. We selected bug-fixing to simulate a real-world scenario that emphasizes the importance of understandable test cases. We observe that participants working on assignments with UTGen test cases fix up to 33% more bugs and use up to 20% less time when compared to baseline test cases. From the post-test questionnaire, we gathered that participants found that enhanced test names, test data, and variable names improved their bug-fixing process.
format Preprint
id arxiv_https___arxiv_org_abs_2408_11710
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests
Deljouyi, Amirhossein
Koohestani, Roham
Izadi, Maliheh
Zaidman, Andy
Software Engineering
Artificial Intelligence
Automated unit test generators, particularly search-based software testing tools like EvoSuite, are capable of generating tests with high coverage. Although these generators alleviate the burden of writing unit tests, they often pose challenges for software engineers in terms of understanding the generated tests. To address this, we introduce UTGen, which combines search-based software testing and large language models to enhance the understandability of automatically generated test cases. We achieve this enhancement through contextualizing test data, improving identifier naming, and adding descriptive comments. Through a controlled experiment with 32 participants from both academia and industry, we investigate how the understandability of unit tests affects a software engineer's ability to perform bug-fixing tasks. We selected bug-fixing to simulate a real-world scenario that emphasizes the importance of understandable test cases. We observe that participants working on assignments with UTGen test cases fix up to 33% more bugs and use up to 20% less time when compared to baseline test cases. From the post-test questionnaire, we gathered that participants found that enhanced test names, test data, and variable names improved their bug-fixing process.
title Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2408.11710