计算机科学 ›› 2023, Vol. 50 ›› Issue (11A): 221200145-7.doi: 10.11896/jsjkx.221200145

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

基于SA-UCB算法的Android应用程序自动化测试方法

王嬉, 赵春蕾, 步志亮, 杨艺   

  1. 天津理工大学计算机科学与工程学院 天津 300384
    天津理工大学教育部视觉与系统省部共建重点实验室 天津 300384
    天津理工大学天津市智能计算与软件新技术重点实验室 天津 300384
  • 发布日期:2023-11-09
  • 通讯作者: 赵春蕾(zcltjut@126.com)
  • 作者简介:(1376231271@qq.com)
  • 基金资助:
    科技部“科技助力经济2020”重点专项(SQ2020YFF0413781)

Automated Testing Method of Android Applications Based on SA-UCB Algorithm

WANG Xi, ZHAO Chunlei, BU Zhiliang, YANG Yi   

  1. School of Computer Science and Engineering,Tianjin University of Technology,Tianjin 300384,China
    Key Laboratory of Computer Vision and System of Ministry of Education,Tianjin University of Technology,Tianjin 300384,China
    Tianjin Key Laboratory of Intelligent Computing and New Software Technology,Tianjin University of Technology,Tianjin 300384,China
  • Published:2023-11-09
  • About author:WANG Xi,born in 1998,postgraduate.Her main research interests include Android automated testing and so on.
    ZHAO Chunlei,born in 1979,Ph.D,associate professor,is a member of China Computer Federation.Her main research interests include cybersecurity and so on.
  • Supported by:
    Key Special Project of “Science and Technology Helps Economy 2020” of the Ministry of Science and Technology(SQ2020YFF0413781).

摘要: 针对传统强化学习算法需要行为准则学习导致测试效率偏低这一问题,提出一种基于模型的Android应用程序自动化测试方法——SA-UCB。使用Sarsa算法对测试过程进行指导,采取Q表作为动作策略的选取参照。并针对经典Sarsa算法使用的ε-greedy策略随机性过强的问题,引入上界置信算法(the Upper Confidence Bound Algorithm,UCB算法)来平衡测试过程中的“探索-利用窘境”,从而对Sarsa算法进行改进,使动作决策更加分散化,并将其应用于Android自动化测试过程,提高了测试效率。将SA-UCB方法与其他5种测试方法从测试覆盖率、测试效率、故障检测3个方面进行了测试性能的对比实验,结果表明,在相同的实验条件下,SA-UCB策略在测试覆盖率和测试效率方面具有一定优势。

关键词: Android, 自动化测试, 强化学习, Sarsa, UCB

Abstract: Aiming at the problem that the traditional reinforcement learning algorithm needs to learn the code of conduct,which leads to low testing efficiency,a model-based automated testing method for Android applications,SA-UCB,is proposed.The Sarsa algorithm is used to guide the test process,and the Q table is used as the reference for action strategy selection.And for the randomness of ε-greedy integrated by the classical Sarsa algorithm is too strong,the upper confidence bound algorithm(UCB algorithm) is introduced to balance the “exploration-exploitation dilemma”,which makes action decisions more decentralized.And it is applied to the Android automated testing process,the testing efficiency is improved.The SA-UCB method is compared with other five test methods in terms of test coverage,test efficiency and fault detection.The results show that SA-UCB strategy has certain advantages in test coverage and test efficiency under the same experimental conditions.

Key words: Android, Automated testing, Reinforcement learning, Sarsa, UCB

中图分类号: 

  • TP391
[1]China Internet Network Information Center.The 49th ChinaStatistical Report on Internet Development[R].Beijing:China Internet Network Information Center,2022.
[2]LIU I J,JAIN U,YEH R A,et al.Cooperative exploration formulti-agent deep reinforcement learning[C]//International Conference on Machine Learning.PMLR,2021:6826-6836.
[3]BELHADI A,DJENOURI Y,SRIVASTAVA G,et al.Rein-forcement learning multi-agent system for faults diagnosis of mircoservices in industrial settings[J].Computer Communications,2021,177:213-219.
[4]IBARZ J,TAN J,FINN C,et al.How to train your robot with deep reinforcement learning:lessons we have learned[J].The International Journal of Robotics Research,2021,40(4/5):698-721.
[5]ZHU K,ZHANG T.Deep reinforcement learning based mobile robot navigation:A review[J].Tsinghua Science and Technology,2021,26(5):674-691.
[6]ZHANG Z,LINIGER A,DAI D,et al.End-to-end urban driving by imitating a reinforcement learning coach[C]//Proceedings of the IEEE/CVF International Conference on Computer Vision.2021:15222-15232.
[7]AMALFITANO D,FASOLINO A R,TRAMONTANA P,et al.Using gui ripping for automated testing of android applications[C]//2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.IEEE,2012:258-261.
[8]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.
[9]YANG W,PRASAD M R,XIE T.A grey-box approach for automated gui-model generation of mobile applications[C]//International Conference on Fundamental Approaches to Software Engineering.Springer,2013:250-265.
[10]BAEK Y M,BAE D H.Automated model-based android gui tes-ting using multi-level gui comparison criteriaC]//Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering.2016:238-249.
[11]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.
[12]LI Y,YANG Z,GUO Y,et al.Droidbot:a lightweight ui-guided test input generator for android[C]//2017 IEEE/ACM 39th International Conference on Software Engineering Companion(ICSEC).IEEE,2017:23-26.
[13]CAI T,ZHANG Z,YANG P.Fastbot:A multi-agent model-based test generation system[C]//Proceedings of the IEEE/ACM 1st International Conference on Automation of Software Test.2020:93-96.
[14]LV Z,PENG C,ZHANG Z,et al.Fastbot2:Reusable Automated Model-based GUI Testing for Android Enhanced by Reinforcement Learning[C]//37th IEEE/ACM International Conference on Automated Software Engineering.2022:1-5.
[15]ADAMO D,KHAN M K,KOPPULA S,et al.Reinforcement learning for android gui testing[C]//Proceedings of the 9th ACM SIGSOFT International Workshop on Automating TEST Case Design,Selection,and Evaluation.2018:2-8.
[16]ZHOU Z.Machine Learning[M].Tsinghua University Press,2016.
[17]MARIANI L,PEZZE M,RIGANELLI O.Autoblacktest:Au-tomatic black-box testing of interactive applications[C]//2012 IEEE Fifth International Conference on Software Testing,Verification and Validation.IEEE,2012:81-90.
[18]KOROGLU Y,SEN A,MUSLU O.Qbe:Qlearning-based exploration of android applications[C]//2018 IEEE 11th International Conference on Software Testing,Verification and Validation(ICST).IEEE,2018:105-115.
[19]YASIN H N,HAMID S H A,RAJA YUSOF R J.Droidbotx:Test case generation tool for android applications using q-lear-ning[J].Symmetry,2021,13(2):310.
[20]LI Y,YANG Z,GUO Y,et al.A deep learning based approach to automated android app testing[J].arXiv:1901.02633,2019.
[21]VUONG T A T,TAKADA S.Semantic analysis for deep q-network in android gui testing[C]//SEKE.2019:123-170.
[22]SUTTON R S,BARTO A G.Reinforcement learning:An introduction[M].MIT Press,2018.
[23]WANG Y H,LI T H S,LIN C J.Backward q-learning:Thecombination of sarsa algorithm and q-learning[J].Engineering Applications of Artificial Intelligence,2013,26(9):2184-2193.
[24]GU T,CAO C,LIU T.Aimdroid:Activity-insulated multi-level automated testing for android applications[C]//2017 IEEE International Conference on Software Maintenance and Evolution(ICSME).IEEE,2017:103-114.
[25]KHAN M K,BRYCE R.Android gui test generation with sarsa[C]//2022 IEEE 12th Annual Computing and Communication Workshop and Conference(CCWC).IEEE,2022:487-493.
[26]CARINO S,ANDREWS J H.Dynamically testing GUIs using ant colony optimization(T)[C]//2015 30th IEEE/ACM International Conference on Automated Software Engineering(ASE).IEEE,2015:138-148.
[27]ABUL O,POLAT F,ALHAJJ R.Multiagent reinforcementlearning using function approximation[J].IEEE Transactions on Systems,Man,and Cybernetics,Part C(Applications and Reviews),2000,30(4):485-497,56.
[28]CHOUDHARY S R,GORLA A,ORSO A.Automated test input generation for android:Are we there yet?[C]//2015 30th IEEE/ACM International Conference on Automated Software Engineering(ASE).IEEE,2015:429-440.
[29]LAM W,WU Z,LI D.Record and replay for android:Are we there yet in industrial cases?[C]//Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering.2017:854-859.
[30]APKFab.[OL].https://apkfab.com/.
[31]Tencent Software Center[OL].https://pc.qq.com/.
[32]Google.Ui/application exerciser monkey[EB/OL].[2022-09-26].https://developer.android.com/studio/test/monkey.html.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!