Skip to main content

A Deep Reinforcement Learning-Based Approach for Android GUI Testing

  • Conference paper
  • First Online:
Web and Big Data (APWeb-WAIM 2022)

Abstract

The mobile application market is booming, and Android applications occupy a vast market share. However, the applications may contain many errors. The task in the testing phase is to find these errors as soon as possible. It is urgent to test the application rapidly and effectively. Otherwise, it may affect user experience and cause substantial economic losses. Mobile applications iterate continuously to consummate performance and functional requirements, which leads to the increased complexity of applications and explosive growth of state combinations. Reinforcement learning aims to learn strategies to achieve specific goals by maximizing rewards. This paper applies it to Android GUI testing. In this paper, we propose ATAC. It is black-box based and adopts Advantage Actor-Critic (A2C) algorithm, which contains an actor (policy) and a critic (value function) to generate test cases automatically through deep reinforcement learning. To verify the validity of the proposed approach, we conducted our experiment on seventeen open-source applications from Github. Compared with ARES and Monkey, ATAC shows higher code coverage and detects more errors.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. 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, Selection, and Evaluation, A-TEST@SIGSOFT FSE 2018, Lake Buena Vista, FL, USA, 05 November 2018, pp. 2–8. ACM (2018)

    Google Scholar 

  2. Amalfitano, D., Fasolino, A.R., Tramontana, P., Carmine, S.D., Memon, A.M.: Using GUI ripping for automated testing of Android applications. In: IEEE/ACM International Conference on Automated Software Engineering, ASE 2012, Essen, Germany, 3–7 September 2012, pp. 258–261. ACM (2012)

    Google Scholar 

  3. Amalfitano, D., Fasolino, A.R., Tramontana, P., Ta, B.D., Memon, A.M.: MobiGUITAR: automated model-based testing of mobile apps. IEEE Softw. 32(5), 53–59 (2015)

    Article  Google Scholar 

  4. Anand, S., Naik, M., Harrold, M.J., Yang, H.: Automated concolic testing of smartphone apps. In: 20th ACM SIGSOFT Symposium on the Foundations of Software Engineering (FSE-2012), SIGSOFT/FSE 2012, Cary, NC, USA, 11–16 November 2012, p. 59. ACM (2012)

    Google Scholar 

  5. Baek, Y.M., Bae, D.: Automated model-based Android GUI testing using multi-level GUI comparison criteria. In: Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, ASE 2016, Singapore, 3–7 September 2016, pp. 238–249. ACM (2016)

    Google Scholar 

  6. Brockman, G., et al.: OpenAI gym. CoRR abs/1606.01540 (2016)

    Google Scholar 

  7. 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, OOPSLA 2013, Part of SPLASH 2013, Indianapolis, IN, USA, 26–31 October 2013, pp. 623–640. ACM (2013)

    Google Scholar 

  8. Collins, E., Dias-Neto, A.C., Vincenzi, A., Maldonado, J.C.: Deep reinforcement learning based Android application GUI testing. In: SBES 2021: 35th Brazilian Symposium on Software Engineering, Joinville, Santa Catarina, Brazil, 27 September–1 October 2021, pp. 186–194. ACM (2021)

    Google Scholar 

  9. Degris, T., Pilarski, P.M., Sutton, R.S.: Model-free reinforcement learning with continuous action in practice. In: American Control Conference, ACC 2012, Montreal, QC, Canada, 27–29 June 2012, pp. 2177–2182. IEEE (2012)

    Google Scholar 

  10. Android Developers: Android debug bridge (ADB). https://developer.android.com/studio/command-line/adb

  11. Dong, Z., Böhme, M., Cojocaru, L., Roychoudhury, A.: Time-travel testing of Android apps. In: ICSE 2020: 42nd International Conference on Software Engineering, Seoul, South Korea, 27 June–19 July 2020, pp. 481–492. ACM (2020)

    Google Scholar 

  12. EclEmma: Jacoco Java code coverage library. https://www.eclemma.org/jacoco/index.html

  13. Espada, A.R., Gallardo, M., Salmerón, A., Merino, P.: Using model checking to generate test cases for Android applications. In: Proceedings Tenth Workshop on Model Based Testing, MBT 2015, London, UK, 18 April 2015, vol. 180, pp. 7–21. EPTCS (2015)

    Google Scholar 

  14. Gao, X., Tan, S.H., Dong, Z., Roychoudhury, A.: Android testing via synthetic symbolic execution. In: Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, ASE 2018, Montpellier, France, 3–7 September 2018, pp. 419–429. ACM (2018)

    Google Scholar 

  15. GitHub. https://github.com

  16. Google: UI/application exerciser monkey. https://developer.android.com/studio/test/monkey

  17. NCC Group: Intent fuzzer. https://www.nccgroup.trust/us/our-research/intent-fuzzer/

  18. Gu, T., et al.: AimDroid: activity-insulated multi-level automated testing for Android applications. In: 2017 IEEE International Conference on Software Maintenance and Evolution, ICSME 2017, Shanghai, China, 17–22 September 2017, pp. 103–114. IEEE Computer Society (2017)

    Google Scholar 

  19. Gu, T., et al.: Practical GUI testing of Android applications via model abstraction and refinement. In: Proceedings of the 41st International Conference on Software Engineering, ICSE 2019, Montreal, QC, Canada, 25–31 May 2019, pp. 269–280. IEEE/ACM (2019)

    Google Scholar 

  20. Li, X., et al.: RLINK: deep reinforcement learning for user identity linkage. World Wide Web 24(1), 85–103 (2021). https://doi.org/10.1007/s11280-020-00833-8

    Article  Google Scholar 

  21. Machiry, A., Tahiliani, R., Naik, M.: Dynodroid: an input generation system for Android apps. In: Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering, ESEC/FSE 2013, Saint Petersburg, Russian Federation, 18–26 August 2013, pp. 224–234. ACM (2013)

    Google Scholar 

  22. 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 (FSE-22), Hong Kong, China, 16–22 November 2014, pp. 599–609. ACM (2014)

    Google Scholar 

  23. Mnih, V., et al.: Asynchronous methods for deep reinforcement learning. In: Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, 19–24 June 2016. JMLR.org (2016)

    Google Scholar 

  24. Appium: Mobile app automation made awesome (n.d.). http://appium.io/

  25. Pan, M., Huang, A., Wang, G., Zhang, T., Li, X.: Reinforcement learning based curiosity-driven testing of Android applications. In: ISSTA 2020: 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, Virtual Event, USA, 18–22 July 2020, pp. 153–164. ACM (2020)

    Google Scholar 

  26. Romdhana, A., Merlo, A.: Keynote: ARES: a deep reinforcement learning tool for black-box testing of Android apps. In: 19th IEEE International Conference on Pervasive Computing and Communications Workshops and other Affiliated Events, PerCom Workshops 2021, Kassel, Germany, 22–26 March 2021, p. 173. IEEE (2021)

    Google Scholar 

  27. 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, Debugging, and Analytics (PERTEA), WODA+PERTEA 2014, San Jose, CA, USA, 22 July 2014, pp. 1–5. ACM (2014)

    Google Scholar 

  28. Su, T., et al.: Guided, stochastic model-based GUI testing of Android apps. In: Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2017, Paderborn, Germany, 4–8 September 2017, pp. 245–256. ACM (2017)

    Google Scholar 

  29. Sutton, R.S., Barto, A.G.: Reinforcement Learning - An Introduction. Adaptive Computation and Machine Learning. MIT Press, Cambridge (1998)

    Google Scholar 

  30. Takala, T., Katara, M., Harty, J.: Experiences of system-level model-based GUI testing of an Android application. In: Fourth IEEE International Conference on Software Testing, Verification and Validation, ICST 2011, Berlin, Germany, 21–25 March 2011, pp. 377–386. IEEE Computer Society (2011)

    Google Scholar 

  31. 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, A-TEST@SIGSOFT FSE 2018, Lake Buena Vista, FL, USA, 05 November 2018, pp. 31–37. ACM (2018)

    Google Scholar 

  32. Vuong, T.A.T., Takada, S.: Semantic analysis for deep Q-network in Android GUI testing. In: The 31st International Conference on Software Engineering and Knowledge Engineering, SEKE 2019, Hotel Tivoli, Lisbon, Portugal, 10–12 July 2019, pp. 123–170. KSI Research Inc. and Knowledge Systems Institute Graduate School (2019)

    Google Scholar 

  33. Williams, R.J.: Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn. 8, 229–256 (1992). https://doi.org/10.1007/BF00992696

    Article  MATH  Google Scholar 

  34. Ye, H., Cheng, S., Zhang, L., Jiang, F.: DroidFuzzer: fuzzing the Android apps with intent-filter tag. In: The 11th International Conference on Advances in Mobile Computing & Multimedia, MoMM 2013, Vienna, Austria, 2–4 December 2013, p. 68. ACM (2013)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Chuanqi Tao .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Gao, Y., Tao, C., Guo, H., Gao, J. (2023). A Deep Reinforcement Learning-Based Approach for Android GUI Testing. In: Li, B., Yue, L., Tao, C., Han, X., Calvanese, D., Amagasa, T. (eds) Web and Big Data. APWeb-WAIM 2022. Lecture Notes in Computer Science, vol 13423. Springer, Cham. https://doi.org/10.1007/978-3-031-25201-3_20

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-25201-3_20

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-25200-6

  • Online ISBN: 978-3-031-25201-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics