Bugs in Solidity smart contracts have led to significant financial losses, highlighting the importance of rigorous testing. Mutation testing is a powerful technique for evaluating test suite adequacy by identifying undetected faults introduced through small code changes. However, writing test cases for detecting live mutants is a labor-intensive task. This is especially true in the context of smart contracts, which involve complex interactions, access control considerations, and blockchain-specific behavior. To address this challenge, we propose Alchemist, a framework for generating Solidity test cases using Large Language Models (LLMs). Alchemist embeds the principles of the scientific method into the code generation process. This workflow can support the creation of more focused and interpretable mutant-killing tests, ultimately reducing developer effort.

Alchemist: LLM-Driven Test Generation using Solidity Mutants and the Scientific Method

Barboni, Morena;Lampa, Filippo;Morichetta, Andrea;Polini, Andrea;
2025-01-01

Abstract

Bugs in Solidity smart contracts have led to significant financial losses, highlighting the importance of rigorous testing. Mutation testing is a powerful technique for evaluating test suite adequacy by identifying undetected faults introduced through small code changes. However, writing test cases for detecting live mutants is a labor-intensive task. This is especially true in the context of smart contracts, which involve complex interactions, access control considerations, and blockchain-specific behavior. To address this challenge, we propose Alchemist, a framework for generating Solidity test cases using Large Language Models (LLMs). Alchemist embeds the principles of the scientific method into the code generation process. This workflow can support the creation of more focused and interpretable mutant-killing tests, ultimately reducing developer effort.
2025
Ethereum
Large Language Model
Mutation Testing
Smart Contract
Solidity
Test Generation
273
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11581/496012
 Attenzione

Attenzione! I dati visualizzati non sono stati sottoposti a validazione da parte dell'ateneo

Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 0
  • ???jsp.display-item.citation.isi??? ND
social impact