Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Tools

Shreya Bhatia, Tarushi Gandhi, Dhruv Kumar, Pankaj Jalote
12/17/2023
cs.SEcs.AI

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Generating unit tests is a crucial task in software development, demanding substantial time and effort from programmers. The advent of Large Language Models (LLMs) introduces a novel avenue for unit test script generation.

Show full abstract

This research aims to experimentally investigate the effectiveness of LLMs, specifically exemplified by ChatGPT, for generating unit test scripts for Python programs, and how the generated test cases compare with those generated by an existing unit test generator (Pynguin). For experiments, we consider three types of code units: 1) Procedural scripts, 2) Function-based modular code, and 3) Class-based code. The generated test cases are evaluated based on criteria such as coverage, correctness, and readability. Our results show that ChatGPT's performance is comparable with Pynguin in terms of coverage, though for some cases its performance is superior to Pynguin. We also find that about a third of assertions generated by ChatGPT for some categories were incorrect. Our results also show that there is minimal overlap in missed statements between ChatGPT and Pynguin, thus, suggesting that a combination of both tools may enhance unit test generation performance. Finally, in our experiments, prompt engineering improved ChatGPT's performance, achieving a much higher coverage.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{bhatia2023unit,
  title  = {Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Tools},
  author = {Shreya Bhatia and Tarushi Gandhi and Dhruv Kumar and Pankaj Jalote},
  year   = {2023},
  eprint = {2312.10622},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2312.10622v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2312.10622.svg)](https://codeofpaper.com/paper/2312.10622)

Discussion