Exploring the Effectiveness of Large Language Models in Generating Unit Tests

04/30/2023
by   Mohammed Latif Siddiq, et al.
0

A code generation model generates code by taking a prompt from a code comment, existing code, or a combination of both. Although code generation models (e.g., GitHub Copilot) are increasingly being adopted in practice, it is unclear whether they can successfully be used for unit test generation without fine-tuning. To fill this gap, we investigated how well three generative models (CodeGen, Codex, and GPT-3.5) can generate test cases. We used two benchmarks (HumanEval and Evosuite SF110) to investigate the context generation's effect in the unit test generation process. We evaluated the models based on compilation rates, test correctness, coverage, and test smells. We found that the Codex model achieved above 80 model had more than 2 tests also suffered from test smells, such as Duplicated Asserts and Empty Tests.

READ FULL TEXT
research
05/07/2023

No More Manual Tests? Evaluating and Improving ChatGPT for Unit Test Generation

Unit testing is essential in detecting bugs in functionally-discrete pro...
research
08/15/2023

Automated Test Case Generation Using Code Models and Domain Adaptation

State-of-the-art automated test generation techniques, such as search-ba...
research
02/13/2023

Adaptive Test Generation Using a Large Language Model

Unit tests play a key role in ensuring the correctness of software. Howe...
research
05/18/2020

Generating Unit Tests for Documentation

Software projects capture information in various kinds of artifacts, inc...
research
07/10/2023

RLTF: Reinforcement Learning from Unit Test Feedback

The goal of program synthesis, or code generation, is to generate execut...
research
07/24/2021

Linear unit-tests for invariance discovery

There is an increasing interest in algorithms to learn invariant correla...
research
04/12/2022

Toward Granular Automatic Unit Test Case Generation

Unit testing verifies the presence of faults in individual software comp...

Please sign up or login with your details

Forgot password? Click here to reset