Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
38 tokens/sec
GPT-4o
59 tokens/sec
Gemini 2.5 Pro Pro
41 tokens/sec
o3 Pro
7 tokens/sec
GPT-4.1 Pro
50 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Tools (2312.10622v2)

Published 17 Dec 2023 in cs.SE and cs.AI

Abstract: Generating unit tests is a crucial task in software development, demanding substantial time and effort from programmers. The advent of LLMs introduces a novel avenue for unit test script generation. 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.

User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (4)
  1. Shreya Bhatia (2 papers)
  2. Tarushi Gandhi (2 papers)
  3. Dhruv Kumar (41 papers)
  4. Pankaj Jalote (5 papers)
Citations (7)
X Twitter Logo Streamline Icon: https://streamlinehq.com