计算机科学 ›› 2025, Vol. 52 ›› Issue (12): 40-47.doi: 10.11896/jsjkx.241100054

• 计算机软件&体系架构 • 上一篇    下一篇

基于强化学习的分布式Android应用自动化测试方法

宋日荣, 陈钦文, 陈星   

  1. 福州大学计算机与大数据学院 福州 350116
    大数据智能教育部工程研究中心 福州 350116
    福建省网络计算与智能信息处理重点实验室(福州大学) 福州 350116
  • 收稿日期:2024-11-08 修回日期:2025-01-23 出版日期:2025-12-15 发布日期:2025-12-09
  • 通讯作者: 陈星(chenxing@fzu.edu.cn)
  • 作者简介:(songrirong@foxmail.com)
  • 基金资助:
    国家自然科学基金(62072108);福建省促进海洋与渔业产业高质量发展专项资金(FJHYF-ZH-2023-02);福建省技术创新重点攻关及产业化项目(2024XQ004)

Distributed Automated Testing for Android Applications Based on Reinforcement Learning

SONG Rirong, CHEN Qinwen, CHEN Xing   

  1. College of Computer and Data Science, Fuzhou University, Fuzhou 350116, China
    Engineering Research Center of Big Data Intelligence, Ministry of Education, Fuzhou 350116, China
    Fujian Key Laboratory of Network Computing and Intelligent Information Processing(Fuzhou University), Fuzhou 350116, China
  • Received:2024-11-08 Revised:2025-01-23 Published:2025-12-15 Online:2025-12-09
  • About author:SONG Rirong,born in 2000,postgraduate.His main research interest is Android automated testing.
    CHEN Xing,born in 1985,Ph.D,professor,Ph.D supervisor,is a member of CCF(No.35725M).His main research interests include software systems and engineering approaches for cloud and mobility.His current projects cover the topics from self-adaptive software,computation offloading,model driven approach and so on.He has published over 100 journal and conference articles,including IEEE Transactions on Parallel and Distributed Systems,IEEE Transactions on Mobile Computing,IEEE Transactions on Cloud Computing,IEEE Transactions on Industrial Informatics,etc.
  • Supported by:
    This work was supported by the National Natural Science Foundation of China(62072108),Special Funds for Promoting High-quality Development of Marine and Fishery Industries in Fujian Province (FJHYF-ZH-2023-02) and Fujian Key Technological Innovation and Industrialization Projects (2024XQ004).

摘要: Android应用程序已经深深融入人们日常生活的方方面面,确保这些应用的正确性是一个极具挑战性的任务。传统测试方法主要依赖于手工操作,自动化测试技术尽管有所发展但仍有待改进。Android应用程序不断迭代以完善性能和功能需求,导致了应用程序复杂性的增加和状态组合的爆炸性增长。测试Android应用的核心在于探索复杂的用户交互下的深层故障,但是这些故障的搜索空间是巨大的,需要花费大量的时间来进行测试。近年来,研究人员开始使用强化学习来测试Android应用,利用智能体与Android应用交互过程中获得的奖励来调整探索策略。然而,现有工作仅利用单台设备进行测试,测试效率十分有限。为了应对上述挑战,提出了一种基于强化学习的分布式Android应用自动化测试框架DistributedAndroidExplore(DAE),利用多个智能体同时对应用程序进行基于强化学习的测试,并定期迭代地聚合每个智能体累积的学习经验,以此提高测试效率。在10个真实世界的Android应用程序上对DAE进行了评估,结果表明,在大多数情况下,DAE的故障检测率、代码覆盖率均优于所对比的基准算法。同时测试效率明显优于其他方法,性能提高了16.5%~34.3%。

关键词: 分布式系统, Android应用程序, 强化学习, Q-learning, 自动化测试

Abstract: Android applications have become deeply integrated into various aspects of people’s daily lives.However,ensuring the correctness of these applications remains a highly challenging task.Traditional testing methods primarily rely on manual operations,while automated testing technologies,despite advancements,still require improvements.The continuous iteration of Android applications to enhance performance and meet functional requirements has led to increased application complexity and an explosive growth in state combinations.Testing the core aspects of Android applications involves exploring deep-seated failures under complex user interactions,but the search space for these failures is vast,necessitating substantial time investment for thorough testing.In recent years,researchers have begun employing reinforcement learning to test Android applications by adjusting exploration strategies based on rewards obtained during the interaction between agents and the Android applications.However,existing work has been limited to testing with a single device,significantly constraining testing efficiency.To address these challenges,this paper proposes a distributed automated testing framework for Android applications based on reinforcement learning,named DistributedAndroidExplore(DAE).DAE utilizes multiple agents to concurrently conduct reinforcement learning-based testing on applications and periodically iterates to aggregate the cumulative learning experiences of each agent,thereby enhancing testing efficiency.DAE is evaluated on 10 real-world Android applications.The results indicate that,in most cases,DAE surpasses the compared benchmark algorithms in terms of fault detection rate and code coverage.Furthermore,DAE demonstrates notably higher testing efficiency,with performance improvements ranging from 16.5% to 34.3%.

Key words: Distributed system, Android applications, Reinforcement learning, Q-learning, Automated testing

中图分类号: 

  • TP311
[1]TANG W H,TANG S H,LIAO C L.China’s Mobile Internet in the 5G Era——Release of the “Development Report of China’s Mobile Internet(2020)”[J].China Newspaper Industry,2020(17):32-35.
[2]ZELENCHUK D,ZELENCHUK D.Supervised monkey testswith espresso and UI automator[M]//Android Espresso Revealed:Writing Automated UI Tests.Berkeley,CA:Apress,2019:255-269.
[3]PAYDAR S.An empirical study on the effectiveness of monkey testing for android applications[J].Iranian Journal of Science and Technology,Transactions of Electrical Engineering,2020,44(2):1013-1029.
[4]KALYSCH A,DEUTEL M,MÜLLER T.Template-based Android inter process communication fuzzing[C]//Proceedings of the 15th International Conference on Availability,Reliability and Security.2020:1-6.
[5]SU T,MENG G,CHEN Y,et al.Guided,stochastic model-based GUI testing of Android apps[C]//Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering.2017:245-256.
[6]AMALFITANO D,FASOLINO A R,TRAMONTANA P,et al.Using GUI ripping for automated testing of Android applications[C]//Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.2012:258-261.
[7]AMALFITANO D,FASOLINO A R,TRAMONTANA P,et al.MobiGUITAR:Automated model-based testing of mobile apps[J].IEEE Software,2014,32(5):53-59.
[8]NGUYEN B N,ROBBINS B,BANERJEE I,et al.GUITAR:an innovative tool for automated testing of GUI-driven software[J].Automated Software Engineering,2014,21:65-105.
[9]MAO K,HARMAN M,JIA Y.Sapienz:Multi-objective automated testing for android applications[C]//Proceedings of the 25th International Symposium on Software Testing and Analysis.2016:94-105.
[10]MAHMOOD R,MIRZAEI N,MALEK S.Evodroid:Segmented evolutionary testing of android apps[C]//Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering.2014:599-609.
[11]GAO X,TAN S H,DONG Z,et al.Android testing via synthetic symbolic execution[C]//Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering.2018:419-429.
[12]PAN M,HUANG A,WANG G,et al.Reinforcement learning based curiosity-driven testing of Android applications[C]//Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis.2020:153-164.
[13]ROMDHANA A,MERLO A,CECCATO M,et al.Deep rein-forcement learning for black-box testing of android apps[J].ACM Transactions on Software Engineering and Methodology,2022,31(4):1-29.
[14]GAO Y,TAO C,GUO H,et al.A Deep Reinforcement Learning-Based Approach for Android GUI Testing[C]//Asia-Pacific Web(APWeb) and Web-Age Information Management(WAIM) Joint International Conference on Web and Big Data.Cham:Springer,2023:262-276.
[15]LÓPEZ Y P,COLONNA J G,SILVA E D A,et al.Q-funcT:A Reinforcement Learning Approach for Automated Black Box Functionality Testing[C]//2022 IEEE 2nd International Conference on Software Engineering and Artificial Intelligence(SEAI).IEEE,2022:119-123.
[16]COLLINS E,NETO A,VINCENZI A,et al.Deep reinforcement learning based Android application GUI testing[C]//Proceedings of the XXXV Brazilian Symposium on Software Engineering.2021:186-194.
[17]LU P,YANG C Z,YOU Z J.DiLAD:A Distributed Layout Testing Framework for Android Applications[C]//2020 the 3rd International Conference on Computing and Big Data.2020:24-29.
[18]BORGES JR N P,GÓMEZ M,ZELLER A.Guiding app testing with mined interaction models[C]//Proceedings of the 5th International Conference on Mobile Software Engineering and Systems.2018:133-143.
[19]KOROGLU Y,SEN A,MUSLU O,et al.QBE:QLearning-based exploration of android applications[C]//2018 IEEE 11thInternational Conference on Software Testing,Verification and Validation(ICST).IEEE,2018:105-115.
[20]WANG Y,CHEN Y R,CHEN X,et al.Automating Release of Android APIs via Computational Reflection [J].Computer Science,2022,49(12):136-145.
[21]ESKONEN J,KAHLES J,REIJONEN J.Automating gui testing with image-based deep reinforcement learning[C]//2020 IEEE International Conference on Autonomic Computing and Self-Organizing Systems(ACSOS).IEEE,2020:160-167.
[22]Android Uiautomator2 Python Wrapper[EB/OL].https://github.com/openatx/uiautomator2.
[23]Eclemma.JaCoCo Java Code Coverage Library[EB/OL](2020).https://www.eclemma.org/jacoco/index.html.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!