Academic Publication Evaluating and Improving ChatGPT for Unit Test Generation
Research Abstract & Technology Focus
e.g.
, methods). Manually writing high-quality unit tests is time-consuming and laborious. Although the traditional techniques are able to generate tests with reasonable coverage, they are shown to exhibit low readability and still cannot be directly adopted by developers in practice. Recent work has shown the large potential of large language models (LLMs) in unit test generation. By being pre-trained on a massive developer-written code corpus, the models are capable of generating more human-like and meaningful test code.
In this work, we perform the first empirical study to evaluate the capability of ChatGPT (
i.e
., one of the most representative LLMs with outstanding performance in code generation and comprehension) in unit test generation. In particular, we conduct both a quantitative analysis and a user study to systematically investigate the quality of its generated tests in terms of correctness, sufficiency, readability, and usability. We find that the tests generated by ChatGPT still suffer from correctness issues, including diverse compilation errors and execution failures (mostly caused by incorrect assertions); but the passing tests generated by ChatGPT almost resemble manually-written tests by achieving comparable coverage, readability, and even sometimes developers’ preference. Our findings indicate that generating unit tests with ChatGPT could be very promising if the correctness of its generated tests could be further improved.
Inspired by our findings above, we further propose
ChatTester
, a novel ChatGPT-based unit test generation approach, which leverages ChatGPT itself to improve the quality of its generated tests. Chat Tester incorporates an initial test generator and an iterative test refiner. Our evaluation demonstrates the effectiveness of
ChatTester
by generating
34.3
%
more compilable tests and
18.7
%
more tests with correct assertions than the default ChatGPT. In addition to ChatGPT, we further investigate the generalization capabilities of
ChatTester
by applying it to two recent open-source LLMs (
i.e.
, CodeLlama-Instruct and CodeFuse) and our results show that
ChatTester
can also improve the quality of tests generated by these LLMs.
AI Semantic Synergy Context
Connecting this academic literature to real-world market discussions and products.
Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issues
Since its introduction in November 2022, ChatGPT has rapidly gained popularity due to its remarkable ability in language understanding and human-like responses. ChatGPT, based on GPT-3.5 architectu...
GPT‑5.5 Instant
GPT-5.5 Instant is now ChatGPT’s default model, replacing GPT-5.3 Instant globally. It brings two major upgrades.First, accuracy: hallucinated claims on sensitive medical, legal, and financial prom...
ChatGPT in higher education: factors influencing ChatGPT user satisfaction and continued use intention
Artificial intelligence (AI) chatbots, represented by ChatGPT, have shown significant improvement in natural learning and problem analysis and solving, which could trigger a profound change in the ...
An Empirical Study of the Non-Determinism of ChatGPT in Code Generation
There has been a recent explosion of research on Large Language Models (LLMs) for software engineering tasks, in particular code generation. However, results from LLMs can be highly unstable; non-d...
When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?
With the development of blockchain technology, smart contracts have become an important component of blockchain applications. Despite their crucial role, the development of smart contracts may intr...
Frequently Asked Questions (FAQ)
Curated market intelligence mapped to this research.
What is the core focus of the research titled 'Evaluating and Improving ChatGPT for Unit Test Generation'?
This literature focuses on: Unit testing plays an essential role in detecting bugs in functionally-discrete program units ( e.g. , methods). Manually writing high-quality unit tests is time-consuming and laborious. Although the traditi...
Are there open-source GitHub repositories related to Evaluating and Improving ChatGPT for Unit Test Generation?
Yes, open-source projects like facebookresearch/HyperAgents (Self-referential self-improving agents that can optimize for any computable task) are actively building upon these concepts.
Which startups are commercializing the technology behind Evaluating and Improving ChatGPT for Unit Test Generation?
Products like PromptURLs are bringing this to market. Their focus is: Turn any prompt into a shareable URL for ChatGPT, Claude .
What other academic literature is closely related to 'Evaluating and Improving ChatGPT for Unit Test Generation'?
Yes, highly correlated activity was mapped. An entry titled 'Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issues' discusses this: Since its introduction in November 2022, ChatGPT has rapidly gained popularity due to its remarkable ability in language understanding and human-li...
Cite this Market Intelligence Report
Reference our AI-mapped synergy between this research and the commercial market to instantly build authority.
Commercial Realization
Startups and Open Source tools heavily associated with the concepts explored in this paper.
-
GitHubfacebookresearch/HyperAgents
-
GitHubchatgptprojects/clear-code
-
Product HuntPromptURLs
-
Product HuntChatGPT on CarPlay
SaaS Metrics