论文标题
ADF-GA:基于数据流程的以太坊智能合约的测试案例生成
ADF-GA: Data Flow Criterion Based Test Case Generation for Ethereum Smart Contracts
论文作者
论文摘要
测试是提高以太坊智能合同计划质量的重要技术。但是,当前测试智能合约的工作仅关注智能合同计划的静态问题。仍缺少针对智能合约程序动态测试的面向数据流的测试案例生成方法。为了解决这个问题,本文提出了一种新型的测试案例生成方法,称为ADF-GA(使用遗传算法的基于数据流量标准的基于数据流量标准的测试案例生成),用于基于坚固的以太坊智能合约计划。 ADF-GA旨在通过三个阶段有效地生成一组有效的测试用例。首先,相应的程序控制流图是从源代码构建的。其次,分析生成的控制流程图以获取坚固性程序中的变量信息,找到“要求语句”,并获得定义使用对。最后,使用遗传算法来生成测试用例,其中提出了改进的适应性功能,以计算每个测试案例的定义使用对覆盖物,并使用程序仪器进行仪器。实验研究是对几个代表性坚固计划进行的。结果表明,ADF-GA可以有效地产生测试用例,获得更好的覆盖范围并减少遗传算法中的迭代次数。
Testing is an important technique to improve the quality of Ethereum smart contract programs. However, current work on testing smart contract only focus on static problems of smart contract programs. A data flow oriented test case generation approach for dynamic testing of smart contract programs is still missing. To address this problem, this paper proposes a novel test case generation approach, called ADF-GA (All-uses Data Flow criterion based test case generation using Genetic Algorithm), for Solidity based Ethereum smart contract programs. ADF-GA aims to efficiently generate a valid set of test cases via three stages. First, the corresponding program control flow graph is constructed from the source codes. Second, the generated control flow graph is analyzed to obtain the variable information in the Solidity programs, locate the require statements, and also get the definition-use pairs to be tested. Finally, a genetic algorithm is used to generate test cases, in which an improved fitness function is proposed to calculate the definition-use pairs coverage of each test case with program instrumentation. Experimental studies are performed on several representative Solidity programs. The results show that ADF-GA can effectively generate test cases, achieve better coverage, and reduce the number of iterations in genetic algorithm.