Can Large Language Models Write Good Property-Based Tests?

07/10/2023
by   Vasudev Vikram, et al.
0

Property-based testing (PBT), while an established technique in the software testing research community, is still relatively underused in real-world software. Pain points in writing property-based tests include implementing diverse random input generators and thinking of meaningful properties to test. Developers, however, are more amenable to writing documentation; plenty of library API documentation is available and can be used as natural language specifications for property-based tests. As large language models (LLMs) have recently shown promise in a variety of coding tasks, we explore the potential of using LLMs to synthesize property-based tests. We call our approach PBT-GPT, and propose three different strategies of prompting the LLM for PBT. We characterize various failure modes of PBT-GPT and detail an evaluation methodology for automatically synthesized property-based tests. PBT-GPT achieves promising results in our preliminary studies on sample Python library APIs in , , and .

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/08/2022

Towards Property-Based Tests in Natural Language

We consider a new approach to generate tests from natural language. Rath...
research
02/12/2021

Multiversal views on language models

The virtuosity of language models like GPT-3 opens a new world of possib...
research
03/22/2022

Quickstrom: Property Based Acceptance Testing with LTL Specifications

We present Quickstrom, a property-based testing system for acceptance te...
research
09/09/2023

pun: Fun with Properties; Towards a Programming Language With Built-in Facilities for Program Validation

Property-based testing is a powerful method to validate program correctn...
research
08/03/2021

Towards Substructural Property-Based Testing

We propose to extend property-based testing to substructural logics to o...
research
03/28/2023

Automatically Generating Dockerfiles via Deep Learning: Challenges and Promises

Containerization allows developers to define the execution environment i...
research
04/06/2023

Whose Text Is It Anyway? Exploring BigCode, Intellectual Property, and Ethics

Intelligent or generative writing tools rely on large language models th...

Please sign up or login with your details

Forgot password? Click here to reset