Automated Test Generation For Smart Contracts via On-Chain Test Case Augmentation and Migration


연구 분야: Analysis



학회: 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)


초록

Pre-deployment testing has become essential to ensure the functional correctness of smart contracts. However, since smart contracts are stateful programs integrating many different functionalities, manually writing test cases to cover all potential usages requires significant effort from developers, leading to insufficient testing and increasing risks in practice. Although several testing techniques for smart contracts have been proposed, they primarily focus on detecting common low-level vulnerabilities such as re-entrancy, rather than generating expressive and function-relevant test cases that can reduce manual testing efforts. To bridge the gap, we propose Solmigrator, an automated technique designed to generate expressive and representative test cases for smart contracts. To our knowledge, Solmigrator is the first migration-based test generation technique for smart contracts, which extracts test cases from real-world usages of on-chain contracts and migrates them to test newly developed smart contracts with similar functionalities. Given a target smart contract to be tested and an on-chain similar source smart contract, Solmigrator first transforms the on-chain usage of the source contract into off-chain executable test cases based on on-chain transaction replay and dependency analysis. It then employs fine-grained static analysis to migrate the augmented test cases from the source to the target smart contract. We built a prototype of Solmigrator and have evaluated it on real-world smart contracts within the two most popular categories, ERC20 and ERC721. Our evaluation results demonstrate that Solmigrator effectively extracts test cases from existing on-chain smart contracts and accurately migrates them across different smart contracts, achieving an average precision of 96.3% and accuracy of 93.6%. Furthermore, the results indicate that these migrated test cases effectively cover common key functionalities of the target smart contracts. This provides promising e... Show More


Author Profile
Jiashuo Zhang

School of Computer Science Peking University Beijing China

China
Author Profile
Ting Chen

University of Electronic Science and Technology of China Chengdu China

Andorra
Author Profile
Jianbo Gao

Beijing Key Laboratory of Security and Privacy in Intelligent Transportation Beijing Jiaotong University Beijing China

Andorra

📄 논문 정보

발행 연도 2025년
인용수 89
출판 국가 Australia, Andorra, China
사이트 IEEE
좋아요 수 0

연관 논문 목록 (56건)