Abstract
With the popularity of mobile devices, the software market of mobile applications has been booming in recent years. Android applications occupy a vast market share. However, the applications inevitably contain defects. Defects may affect the user experience and even cause severe economic losses. This paper proposes ATAC and ATPPO, which apply reinforcement learning to Android GUI testing to mitigate the state explosion problem. The article designs a new reward function and a new state representation. It also constructs two GUI testing models (ATAC and ATPPO) based on A2C and PPO algorithms to save memory space and accelerate training speed. Empirical studies on twenty open-source applications from GitHub demonstrate that: (1) ATAC performs best in 16 of 20 apps in code coverage and defects more exceptions; (2) ATPPO can get higher code coverage in 15 of 20 apps and defects more exceptions; (3) Compared with state-of-art tools Monkey and ARES, ATAC, and ATPPO shows higher code coverage and detects more errors. ATAC and ATPPO can not only cover more code coverage but also can effectively detect more exceptions. This paper also introduces Finite-State Machine into the reinforcement learning framework to avoid falling into the local optimal state, which provides high-level guidance for further improving the test efficiency.
Similar content being viewed by others
Data Availability
No datasets were generated or analysed during the current study.
References
Google: UI/Application Exerciser Monkey. https://developer.android.com/studio/test/monkey
Amalfitano, D., Fasolino, A.R., Tramontana, P., Carmine, S.D., Memon, A.M.: Using GUI ripping for automated testing of android applications. In: Goedicke M., Menzies T., Saeki M. (eds.) Proceedings of the 12th IEEE/ACM International Conference on Automated Software Engineering, pp. 258–261. ACM, Essen, Germany (2012)
Collins, E., Dias-Neto, A.C., Vincenzi, A., Maldonado, J.C.: Deep reinforcement learning based android application GUI testing. In: Proceedings of the SBES ’21: 35th Brazilian Symposium on Software Engineering, pp. 186–194. ACM, Joinville, Santa Catarina, Brazil (2021)
Romdhana, A., Merlo, A.: Keynote: ARES: A deep reinforcement learning tool for black-box testing of android apps. In: Proceedings of the 19th IEEE International Conference on Pervasive Computing and Communications Workshops and Other Affiliated Events, p. 173. IEEE, Kassel, Germany (2021)
Williams, R.J.: Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn. 8, 229–256 (1992)
Sutton, R.S., Barto, A.G.: Reinforcement Learning - an Introduction. Adaptive computation and machine learning. MIT Press (1998)
Degris, T., Pilarski, P.M., Sutton, R.S.: Model-free reinforcement learning with continuous action in practice. In: Proceedings of the 2022 American Control Conference, pp. 2177–2182. IEEE, Montreal, QC, Canada (2012)
Mnih, V., Badia, A.P., Mirza, M., Graves, A., Lillicrap, T.P., Harley, T., Silver, D., Kavukcuoglu, K.: Asynchronous methods for deep reinforcement learning. In: Proceedings of the 33nd International Conference on Machine Learning. JMLR.org, New York City, NY, USA (2016)
Köroglu, Y., Sen, A., Muslu, O., Mete, Y., Ulker, C., Tanriverdi, T., Donmez, Y.: QBE: QLearning-based exploration of android applications. In: Proceedings of the 11th IEEE International Conference on Software Testing, Verification and Validation, pp. 105–115. IEEE Computer Society, Sweden (2018)
Pan, M., Huang, A., Wang, G., Zhang, T., Li, X.: Reinforcement learning based curiosity-driven testing of android applications. In: Proceedings of the ISSTA ’20: 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 153–164. ACM, USA (2020)
Adamo, D., Khan, M.K., Koppula, S., Bryce, R.C.: Reinforcement learning for android GUI testing. In: Proceedings of the 9th ACM SIGSOFT International Workshop on Automating TEST Case Design, pp. 2–8. ACM, Lake Buena Vista, FL, USA (2018)
Vuong, T.A.T., Takada, S.: A reinforcement learning based approach to automated testing of android applications. In: Proceedings of the 9th ACM SIGSOFT International Workshop on Automating TEST Case Design, Selection, and Evaluation, pp. 31–37. ACM, Lake Buena Vista, FL, USA (2018)
Vuong, T.A.T., Takada, S.: Semantic analysis for deep Q-network in android GUI testing. In: Proceedings of the 31st International Conference on Software Engineering and Knowledge Engineering, pp. 123–170. KSI Research Inc. and Knowledge Systems Institute Graduate School, Hotel Tivoli, Lisbon, Portugal (2019)
EclEmma: JaCoCo Java Code Coverage Library. https://www.eclemma.org/jacoco/index.html
Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J., Zaremba, W.: Openai Gym. CoRR arXiv:1606.01540 (2016)
[n.d.]: Appium: Mobile App Automation Made Awesome. http://appium.io/
Developers, A.: Android Debug Bridge (ADB). https://developer.android.com/studio/command-line/adb
Machiry, A., Tahiliani, R., Naik, M.: Dynodroid: an input generation system for android apps. In: Proceedings of the Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering, pp. 224–234. ACM, Saint Petersburg, Russian Federation (2013)
Group, N.: Intent Fuzzer. https://www.nccgroup.trust/us/our-research/intent-fuzzer/
Sasnauskas, R., Regehr, J.: Intent fuzzer: crafting intents of death. In: Proceedings of the 2014 Joint International Workshop on Dynamic Analysis (WODA) and Software and System Performance Testing, pp. 1–5. ACM, San Jose, CA, USA (2014)
Ye, H., Cheng, S., Zhang, L., Jiang, F.: Droidfuzzer: Fuzzing the android apps with intent-filter tag. In: Proceedings of the 11th International Conference on Advances in Mobile Computing & Multimedia, p. 68. ACM, Vienna, Austria (2013)
Espada, A.R., Gallardo, M., Salmer’on, A., Merino, P.: Using model checking to generate test cases for android applications. In: Proceedings Tenth Workshop on Model Based Testing. EPTCS, vol. 180, pp. 7–21. London, UK (2015)
Hao, S., Liu, B., Nath, S., Halfond, W.G.J., Govindan, R.: PUMA: programmable UI-automation for large-scale dynamic analysis of mobile apps. In: Proceedings of 12th Annual International Conference on Mobile Systems, Applications, and Services, pp. 204–217. ACM, Bretton Woods, NH, US (2014)
Su, T., Meng, G., Chen, Y., Wu, K., Yang, W., Yao, Y., Pu, G., Liu, Y., Su, Z.: Guided, stochastic model-based GUI testing of android apps. In: Proceedings of the 11th Joint Meeting on Foundations of Software Engineering, pp. 245–256. ACM, Paderborn, Germany (2017)
Mahmood, R., Mirzaei, N., Malek, S.: Evodroid: segmented evolutionary testing of android apps. In: Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 599–609. ACM, Hong Kong, China (2014)
Anand, S., Naik, M., Harrold, M.J., Yang, H.: Automated concolic testing of smartphone apps. In: Proceedings of the 20th ACM SIGSOFT Symposium on the Foundations of Software Engineering, p. 59. ACM, Cary, NC, USA (2012)
Mao, K., Harman, M., Jia, Y.: Sapienz: multi-objective automated testing for android applications. In: Proceedings of the 25th International Symposium on Software Testing and Analysis, pp. 94–105. ACM, Saarbrücken, Germany (2016)
Choi, W., Necula, G.C., Sen, K.: Guided GUI testing of android apps with minimal restart and approximate learning. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, pp. 623–640. ACM, Indianapolis, IN, USA (2013)
Ethics declarations
Consent to participate
Informed consent was obtained from all individual participants.
Competing interests
The authors declare no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Tao, C., Wang, F., Gao, Y. et al. A reinforcement learning-based approach to testing GUI of moblie applications. World Wide Web 27, 16 (2024). https://doi.org/10.1007/s11280-024-01252-9
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11280-024-01252-9