[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
research-article

IABC‐TCG: : Improved artificial bee colony algorithm‐based test case generation for smart contracts

Published: 10 December 2024 Publication History

Abstract

With the widespread application of smart contracts, there is a growing concern over the quality assurance of smart contracts. The data flow testing is an important technology to ensure the correctness of smart contracts. We propose an approach named IABC‐TCG (Improved Artificial Bee Colony‐Test Case Generation) to generate test cases for the data flow testing of smart contracts. With a dominance relations‐based fitness function, an improved artificial bee colony algorithm is used to generate test cases, in which the bee colony search coefficient is adaptively adjusted to improve the effectiveness and efficiency of the search. In addition, an improved test case selection and updation strategy is used to avoid unnecessary test cases. The experimental results show that IABC‐TCG achieves 100% coverage for all the test requirements on a dataset of 30 smart contracts and outperforms the baseline approaches in terms of the number of test cases and the execution time. Performing tests with the generated test cases, IABC‐TCG can find more errors with less test cost.

Graphical Abstract

We propose IABC‐TCG (Improved Artificial Bee Colony‐Test Case Generation) to generate test cases for the data flow testing of smart contracts. The improved ABC (Artificial Bee Colony) algorithm is applied to generate test cases, in which a dominance relations based fitness function is used to guide the searching for test cases that cover the to‐be‐tested definition‐use pairs and the bee colony search coefficient is adaptively adjusted to improve the effectiveness and efficiency of the search. In addition, the test case selection and updation strategy is improved to avoid unnecessary test cases. Experimental results show that IABC‐TCG achieves 100% coverage and outperforms the comparative approaches in the number of test cases and the average execution time.

References

[1]
Zou W, Lo D, Kochhar PS, Le X‐BD, Xia X, Feng Y, Chen Z, Xu B. Smart contract development: challenges and opportunities. IEEE Trans Softw Eng. 2019;47(10):2084‐2106.
[2]
Christidis K, Devetsikiotis M. Blockchains and smart contracts for the internet of things. Ieee Access. 2016;4:2292‐2303.
[3]
Almakhour M, Sliman L, Samhat AE, Mellouk A. Verification of smart contracts: a survey. Pervas Mob Comput. 2020;67:101227.
[4]
He D, Deng Z, Zhang Y, Chan S, Cheng Y, Guizani N. Smart contract vulnerability analysis and security audit. IEEE Netw. 2020;34(5):276‐282.
[5]
SlowMist. 2023 blockchain security and anti‐money laundering annual report, HongKong, China, SlowMist; 2024. https://www.slowmist.com/report/2023-Blockchain-Security-and-AML-Annual-Report(EN).pdf
[6]
Liao J‐W, Tsai T‐T, He C‐K, Tien C‐W. Soliaudit: smart contract vulnerability assessment based on machine learning and fuzz testing. In: 2019 Sixth International Conference on Internet of Things: Systems, Management and Security (IOTSMS) IEEE; 2019:458‐465.
[7]
Wang X, Wu H, Sun W, Zhao Y. Towards generating cost‐effective test‐suite for Ethereum smart contract. In: 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER) IEEE; 2019:549‐553.
[8]
Zhuang Y, Liu Z, Qian P, Liu Q, Wang X, He Q. Smart contract vulnerability detection using graph neural networks. In: Proceedings of the Twenty‐Ninth International Conference on International Joint Conferences on Artificial Intelligence; 2021:3283‐3290.
[9]
Souter AL, Pollock LL. Contextual def‐use associations for object aggregation. In: Proceedings of the 2001 ACM SIGPLAN‐SIGSOFT Workshop on Program Analysis for Software Tools and Engineering; 2001:13‐19.
[10]
Rapps S, Weyuker EJ. Selecting software test data using data flow information. IEEE Trans Softw Eng. 1985;4:367‐375.
[11]
Hutchins M, Foster H, Goradia T, Ostrand T. Experiments on the effectiveness of dataflow‐and control‐flow‐based test adequacy criteria. In: Proceedings of 16th International Conference on Software Engineering IEEE; 1994:191‐200.
[12]
Ghiduk AS, Harrold MJ, Girgis MR. Using genetic algorithms to aid test‐data generation for data‐flow coverage. In: 14th Asia‐Pacific Software Engineering Conference (APSEC'07) IEEE; 2007:41‐48.
[13]
Mei L, Chan WK, Tse TH, Kuo F‐C. An empirical study of the use of Frankl‐Weyuker data flow testing criteria to test BPEL web services. In: 2009 33rd Annual IEEE International Computer Software and Applications Conference, Vol. 1 IEEE; 2009:81‐88.
[14]
Zhang P, Yu J, Ji S. ADF‐GA: data flow criterion based test case generation for Ethereum smart contracts. In: Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops; 2020:754‐761.
[15]
Ji S, Zhu S, Zhang P, Dong H, Yu J. Test‐case generation for data flow testing of smart contracts based on improved genetic algorithm. IEEE Trans Reliab. 2022;72(1):358‐371.
[16]
Ji S, Zhu S, Zhang P, Dong H. Data flow reduction based test case generation for smart contracts. In: 2022 29th Asia‐Pacific Software Engineering Conference (APSEC) IEEE; 2022:149‐158.
[17]
Luu L, Chu D‐H, Olickel H, Saxena P, Hobor A. Making smart contracts smarter. In: Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security; 2016:254‐269.
[18]
Tikhomirov S, Voskresenskaya E, Ivanitskiy I, Takhaviev R, Marchenko E, Alexandrov Y. Smartcheck: static analysis of Ethereum smart contracts. In: Proceedings of the 1st International Workshop on Emerging Trends in Software Engineering for Blockchain; 2018:9‐16.
[19]
Hildenbrandt E, Saxena M, Rodrigues N, et al. KEVM: a complete formal semantics of the Ethereum virtual machine. In: 2018 IEEE 31st Computer Security Foundations Symposium (CSF) IEEE; 2018:204‐217.
[20]
Chan WK, Jiang B. Fuse: An architecture for smart contract fuzz testing service. In: 2018 25th Asia‐Pacific Software Engineering Conference (APSEC) IEEE; 2018:707‐708.
[21]
Mei X, Ashraf I, Jiang B, Chan WK. A fuzz testing service for assuring smart contracts. In: 2019 IEEE 19th International Conference on Software Quality, Reliability and Security Companion (QRS‐C) IEEE; 2019:544‐545.
[22]
Jiang B, Liu Y, Chan WK. Contractfuzzer: fuzzing smart contracts for vulnerability detection. In: Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering; 2018:259‐269.
[23]
Nguyen TD, Pham LH, Sun J, Lin Y, Minh QT. sfuzz: An efficient adaptive fuzzer for solidity smart contracts. In: Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering; 2020:778‐788.
[24]
Choi J, Kim D, Kim S, Grieco G, Groce A, Cha SK. Smartian: enhancing smart contract fuzzing with static and dynamic data‐flow analyses. In: 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE) IEEE; 2021:227‐239.
[25]
Driessen S, Di Nucci D, Monsieur G, Tamburri DA, Heuvel W‐J. Automated test‐case generation for solidity smart contracts: the AGSolT approach and its evaluation. arXiv preprint arXiv:210208864; 2021.
[26]
Panichella A, Kifetew FM, Tonella P. Automated test case generation as a many‐objective optimisation problem with dynamic selection of the targets. IEEE Trans Softw Eng. 2017;44(2):122‐158.
[27]
Zhou T, Liu K, Li L, Liu Z, Klein J, Bissyande TF. Smartgift: learning to generate practical inputs for testing smart contracts. In: 2021 IEEE International Conference on Software Maintenance and Evolution (ICSME) IEEE; 2021:23‐34.
[28]
Krupp J, Rossow C. teEther: gnawing at Ethereum to automatically exploit smart contracts. In: 27th USENIX Security Symposium (USENIX Security 18); 2018:1317‐1333.
[29]
Li Z, Wu H, Xu J, Wang X, Zhang L, Chen Z. Musc: A tool for mutation testing of Ethereum smart contract. In: 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE) IEEE; 2019:1198‐1201.
[30]
Sun J, Huang S, Zheng C, Wang T, Zong C, Hui Z. Mutation testing for integer overflow in Ethereum smart contracts. Tsinghua Sci Technol. 2021;27(1):27‐40.
[31]
Pande HD, Landi WA, Ryder BG. Interprocedural def‐use associations for c systems with single level pointers. IEEE Trans Softw Eng. 1994;20(5):385‐403.
[32]
Harrold MJ, Rothermel G. Performing data flow testing on classes. ACM SIGSOFT Softw Eng Notes. 1994;19(5):154‐163.
[33]
Rajkumari MR, Geetha BG. Automatic test data generation using genetic algorithm and program dependence graph. J Comput Appl. 2010;3(4):1‐6.
[34]
Sheoran S, Mittal N, Gelbukh A. Artificial bee colony algorithm in data flow testing for optimal test suite generation. Int J Syst Assur Eng Manag. 2020;11:340‐349.
[35]
Nayak N, Mohapatra DP. Automatic test data generation for data flow testing using particle swarm optimization. In: International Conference on Contemporary Computing Springer; 2010:1‐12.
[36]
Singla S, Kumar D, Rai HM, Singla P. A hybrid PSO approach to automate test data generation for data flow coverage with dominance concepts. Int J Adv Sci Technol. 2011;37:15‐26.
[37]
Kumar S, Yadav DK, Khan DA. A novel approach to automate test data generation for data flow testing based on hybrid adaptive PSO‐GA algorithm. Int J Adv Intell Paradigms. 2017;9(2‐3):278‐312.
[38]
Kim KB, Lee J. Automated generation of test cases for smart contract security analyzers. IEEE Access. 2020;8:209377‐209392.
[39]
Ashraf I, Ma X, Jiang B, Chan WK. Gasfuzzer: fuzzing Ethereum smart contract binaries to expose gas‐oriented exception security vulnerabilities. IEEE Access. 2020;8:99552‐99564.
[40]
Karaboga D. An idea based on honey bee swarm for numerical optimization. tech. rep., Technical report‐tr06, Türkiye, Erciyes University, Engineering Faculty, Computer Engineering Department; 2005.
[41]
Karaboga D. Artificial bee colony algorithm. Scholarpedia. 2010;5(3):6915.
[42]
Karaboga D, Basturk B. On the performance of artificial bee colony (ABC) algorithm. Appl Soft Comput. 2008;8(1):687‐697.
[43]
Diwold K, Aderhold A, Scheidler A, Middendorf M. Performance evaluation of artificial bee colony optimization and new selection schemes. Memetic Comput. 2011;3:149‐162.
[44]
Pollock LL, Soffa ML. An incremental version of iterative data flow analysis. IEEE Trans Softw Eng. 1989;15(12):1537‐1549.
[45]
Ji S, Zhang P. Test case generation approach for data flow based on dominance relations. Comput Sci. 2020;47(9):40‐46.
[46]
Girgis MR, Ghiduk AS, Abd‐Elkawy EH. Automatic generation of data flow test paths using a genetic algorithm. Int J Comput Appl. 2014;89(12):29‐36.
[47]
Dahiya SS, Chhabra JK, Kumar S. Application of artificial bee colony algorithm to software testing. In: 2010 21st Australian Software Engineering Conference IEEE; 2010:149‐154.
[48]
Zhang P, Xiao F, Luo X. A framework and dataset for bugs in Ethereum smart contracts. In: 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME) IEEE; 2020:139‐150.

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Journal of Software: Evolution and Process
Journal of Software: Evolution and Process  Volume 36, Issue 12
December 2024
222 pages
EISSN:2047-7481
DOI:10.1002/smr.v36.12
Issue’s Table of Contents

Publisher

John Wiley & Sons, Inc.

United States

Publication History

Published: 10 December 2024

Author Tags

  1. artificial bee colony algorithm
  2. data flow testing
  3. smart contract
  4. test case generation

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 0
    Total Downloads
  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 18 Jan 2025

Other Metrics

Citations

View Options

View options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media