[Paper Review] Automated Test-Case Generation for Solidity Smart Contracts: the AGSolT Approach and its Evaluation
This paper presents AGSolT, an automated test-case generation framework for Solidity smart contracts that uses both random fuzzing and the DynaMOSA genetic algorithm to produce concise, high-coverage test suites. It demonstrates that the genetic approach achieves significantly better branch coverage than random testing, while both methods produce similarly sized test suites, and identifies critical crashes in three widely used open-source smart contracts.
Blockchain and smart contract technology are novel approaches to data and code management that facilitate trusted computing by allowing for development in a distributed and decentralized manner. Testing smart contracts comes with its own set of challenges which have not yet been fully identified and explored. Although existing tools can identify and discover known vulnerabilities and their interactions on the Ethereum blockchain through random search or symbolic execution, these tools generally do not produce test suites suitable for human oracles. In this paper, we present AGSOLT (Automated Generator of Solidity Test Suites). We demonstrate its efficiency by implementing two search algorithms to automatically generate test suites for stand-alone Solidity smart contracts, taking into account some of the blockchain-specific challenges. To test AGSOLT, we compared a random search algorithm and a genetic algorithm on a set of 36 real-world smart contracts. We found that AGSOLT is capable of achieving high branch coverage with both approaches and even discovered some errors in some of the most popular Solidity smart contracts on Github.
Motivation & Objective
- To address the lack of effective, human-readable test suites for Solidity smart contracts, which hinders industrial adoption.
- To develop a tool that achieves high branch coverage while minimizing test suite size for practical use in unit and regression testing.
- To evaluate and compare the effectiveness of random search (fuzzing) and guided search (genetic algorithms) in automated smart contract test generation.
- To identify and validate blockchain-specific challenges in test case generation, such as transaction, blockchain, and interactive properties.
- To demonstrate the real-world value of automated test generation by uncovering critical runtime crashes in popular open-source smart contracts.
Proposed method
- AGSolT is implemented as a framework that generates test cases for standalone Solidity smart contracts using two search-based strategies: random fuzzing and the DynaMOSA genetic algorithm.
- The tool leverages developers-provided oracles to validate test outcomes and ensure correctness of generated test cases.
- Branch coverage is used as the primary metric to evaluate test suite effectiveness, with coverage measured via static analysis of the contract's control flow.
- The framework integrates with Ganache to execute test cases in a local blockchain environment, simulating real execution conditions.
- Two search algorithms—fuzzing and DynaMOSA—are implemented with identical hardware and configuration to ensure fair comparison.
- Test suite size and execution time are measured to assess efficiency and practicality for real-world use.
Experimental results
Research questions
- RQ1Can automated test-case generation tools produce concise, high-coverage test suites for Solidity smart contracts that are suitable for human review and use?
- RQ2How do random search (fuzzing) and guided search (genetic algorithms) compare in terms of branch coverage, test suite size, and execution time for smart contract testing?
- RQ3To what extent do real-world smart contracts exhibit blockchain-specific challenges that affect test case generation?
- RQ4Can AGSolT uncover previously unknown critical bugs in widely used open-source smart contracts?
- RQ5How effective is the DynaMOSA genetic algorithm compared to random fuzzing in achieving high branch coverage in smart contract testing?
Key findings
- The DynaMOSA genetic algorithm significantly outperformed the fuzzer in achieving branch coverage, with a statistically significant difference confirmed by the Wilcoxon test.
- Despite the additional computational overhead, the genetic algorithm did not produce significantly larger test suites than the fuzzer, indicating efficiency in test suite compression.
- The fuzzer was not faster than the genetic algorithm, suggesting that DynaMOSA’s preference criterion reduces execution and evaluation time despite its complexity.
- Three of the most popular smart contracts on GitHub exhibited critical runtime crashes during testing, demonstrating AGSolT’s real-world bug-detection capability.
- The study confirms that blockchain-specific properties—such as transaction dependencies, state persistence, and interactive behaviors—pose significant challenges for test generation and must be addressed explicitly.
- The results validate that guided search approaches like DynaMOSA are more effective than random search for achieving high test coverage in smart contract unit testing.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.