Test Case Generation Approach for Android Applications using Reinforcement Learning
Received: 5 April 2024 2024 | Revised: 25 April 2024 | Accepted: 27 April 2024 | Online: 2 August 2024
Corresponding author: Asmau Usman
Abstract
Mobile applications can recognize their computational setting and adjust and respond to actions in the context. This is known as context-aware computing. Testing context-aware applications is difficult due to their dynamic nature, as the context is constantly changing. Most mobile testing tools and approaches focus only on GUI events, adding to the deficient coverage of applications throughout testing. Generating test cases for various context events in Android applications can be achieved using reinforcement learning algorithms. This study proposes an approach for generating Android application test cases based on Expected State-Action-Reward-State-Action (E-SARSA), considering GUI and context events for effective testing. The proposed method was experimentally evaluated on eight Android applications, showing 48-96% line of code coverage across them, which was higher than Q-testing and SARSA.
Keywords:
Android app, GUI event, test case generation, context event, reinforcement learning, expected SarsaDownloads
References
I. A. Salihu, R. Ibrahim, B. S. Ahmed, K. Z. Zamli, and A. Usman, "AMOGA: A static-dynamic model generation strategy for mobile apps testing," IEEE Access, vol. 7, pp. 17158–17173, Jan. 2019, https://doi.org/10.1109/ACCESS.2019.2895504.
H. Muccini, A. Di Francesco, and P. Esposito, "Software testing of mobile applications: Challenges and future research directions," in 2012 7th International Workshop on Automation of Software Test (AST), Zurich, Switzerland, Jun. 2012, pp. 29–35.
A. S. Alkarim, A. Al-Malaise Al-Ghamdi, and M. Ragab, "Ensemble Learning-based Algorithms for Traffic Flow Prediction in Smart Traffic Systems," Engineering, Technology & Applied Science Research, vol. 14, no. 2, pp. 13090–13094, Apr. 2024.
I. A. Salihu, R. Ibrahim, and A. Usman, "A Static-dynamic Approach for UI Model Generation for Mobile Applications," in 2018 7th International Conference on Reliability, Infocom Technologies and Optimization (Trends and Future Directions) (ICRITO), Noida, India, Aug. 2018, pp. 96–100.
D. Chaffey, "Statistics on consumer mobile usage and adoption to inform your mobile marketing strategy mobile site design and app development," Smart Insights, 2021.
H. Packard, "Failing to meet mobile app user expectations: a mobile user survey". Technology Representatives Inc, 2015.
"Mobile Developer Population Reaches 12M Worldwide, Expected to Top 14M by 2020". Evans Data Corporation, May 2016, https://evansdata.com/press/viewRelease.php?pressID=244.
N. C. Eli-Chukwu, J. M. Aloh, and C. O. Ezeagwu, "A Systematic Review of Artificial Intelligence Applications in Cellular Networks," Engineering, Technology & Applied Science Research, vol. 9, no. 4, pp. 4504–4510, Aug. 2019.
I. A. Salihu and R. Ibrahim, "Systematic Exploration of Android Apps’ Events for Automated Testing," in Proceedings of the 14th International Conference on Advances in Mobile Computing and Multi Media, Singapore, Nov. 2016, pp. 50–54.
A. Usman, N. Ibrahim, and I. A. Salihu, "Comparative Study of Mobile Applications Testing Techniques for Context Events," Advanced Science Letters, vol. 24, no. 10, pp. 7305–7310, Oct. 2018.
D. Amalfitano, A. R. Fasolino, P. Tramontana, and N. Amatucci, "Considering Context Events in Event-Based Testing of Mobile Applications," in 2013 IEEE Sixth International Conference on Software Testing, Verification and Validation Workshops, Luxembourg, Mar. 2013, pp. 126–133.
G. D. Abowd, A. K. Dey, P. J. Brown, N. Davies, M. E. Smith, and P. Steggles, "Towards a Better Understanding of Context and Context-Awareness," in Handheld and Ubiquitous Computing, Proceedings, H. W. Gellersen, Ed., Berlin, Germany: Springer, 1999, pp. 304–307.
Z. A. Almusaylim and N. Zaman, "A review on smart home present state and challenges: linked to context-awareness internet of things (IoT)," Wireless Networks, vol. 25, no. 6, pp. 3193–3204, Aug. 2019.
A. M. Mirza et al., "ContextDrive: Towards a Functional Scenario-Based Testing Framework for Context-Aware Applications," IEEE Access, vol. 9, pp. 80478–80490, May 2021.
A. Usman, N. Ibrahim, and I. A. Salihu, "Test Case Generation from Android Mobile Applications Focusing on Context Events," in Proceedings of the 2018 7th International Conference on Software and Computer Applications, Kuantan, Malaysia, Feb. 2018, pp. 25–30.
S. S. Priya and B. Rajalakshmi, "Testing Context Aware Application and its Research Challenges," in 2022 International Conference on Smart Technologies and Systems for Next Generation Computing (ICSTSN), Villupuram, India, Mar. 2022, pp. 1–7.
M. A. Mehmood, M. N. A. Khan, and W. Afzal, "Automating Test Data Generation for Testing Context-Aware Applications," in 2018 IEEE 9th International Conference on Software Engineering and Service Science (ICSESS), Beijing, China, Nov. 2018, pp. 104–108.
A. Usman, N. Ibrahim, and S. Anka, "TEGDroid: Test Case Generation Approach for Android Apps Considering Context and GUI Events," International Journal on Advanced Science, Engineering and Information Technology, vol. 10, no. 1, pp. 16–23, Feb. 2020.
B. R. Siqueira, F. C. Ferrari, K. E. Souza, V. V. Camargo, and R. de Lemos, "Testing of adaptive and context-aware systems: approaches and challenges," Software Testing, Verification and Reliability, vol. 31, no. 7, pp. 1–46, May 2021.
S. Yue, S. Yue, and R. Smith, "A Survey of Testing Context-aware Software: Challenges and Resolution," in Proceedings of the International Conference on Software Engineering Research and Practice (SERP), Las Vegas, Nevada, USA, Sep. 2016, pp. 102–108.
D. R. Almeida, P. D. L. Machado, and W. L. Andrade, "Testing tools for Android context-aware applications: a systematic mapping," Journal of the Brazilian Computer Society, vol. 25, no. 1, pp. 1–22, Dec. 2019, Art. no. 12.
A. M. Mirza and M. N. A. Khan, "An Automated Functional Testing Framework for Context-Aware Applications," IEEE Access, vol. 6, pp. 46568–46583, Aug. 2018.
T. B. Nguyen, T. T. B. Le, O. E. K. Aktouf, and I. Parissis, "Mobile Applications Testing Based on Bigraphs and Dynamic Feature Petri Nets," in The First International Conference on Intelligence of Things (ICIT 2022), Hanoi, Vietnam, Aug. 2022, vol. 148, pp. 215–225.
S. Chen, Z. Chen, Z. Zhao, B. Xu, and Y. Feng, "Using semi-supervised clustering to improve regression test selection techniques," in Verification and Validation 2011 Fourth IEEE International Conference on Software Testing, Berlin, Germany, Mar. 2011, pp. 1–10.
H. Spieker, A. Gotlieb, D. Marijan, and M. Mossige, "Reinforcement learning for automatic test case prioritization and selection in continuous integration," in Proceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis, Santa Barbara, CA, USA, Jul. 2017, pp. 12–22.
B. Ahmed, G. Ali, A. Hussain, A. Baseer, and J. Ahmed, "Analysis of Text Feature Extractors using Deep Learning on Fake News," Engineering, Technology & Applied Science Research, vol. 11, no. 2, pp. 7001–7005, Apr. 2021.
J. Kim, M. Kwon, and S. Yoo, "Generating test input with deep reinforcement learning," in Proceedings of the 11th International Workshop on Search-Based Software Testing, Gothenburg, Sweden, May 2018, pp. 51–58.
Y. P. López, J. G. Colonna, E. De Araujo Silva, R. H. Degaki, and J. M. Silva, "Q-funcT: A Reinforcement Learning Approach for Automated Black Box Functionality Testing," in 2022 IEEE 2nd International Conference on Software Engineering and Artificial Intelligence (SEAI), Xiamen, China, Jun. 2022, pp. 119–123.
A. Romdhana, A. Merlo, M. Ceccato, and P. Tonella, "Deep Reinforcement Learning for Black-box Testing of Android Apps," ACM Transactions on Software Engineering and Methodology, vol. 31, no. 4, pp. 1–29, Apr. 2022, Art. no. 65.
Y. Zhao, B. Harrison, and T. Yu, "DinoDroid: Testing Android Apps Using Deep Q-Networks," ACM Transactions on Software Engineering and Methodology, Nov. 2024.
P. S. Kochhar, F. Thung, N. Nagappan, T. Zimmermann, and D. Lo, "Understanding the Test Automation Culture of App Developers," in 2015 IEEE 8th International Conference on Software Testing, Verification and Validation (ICST), Graz, Austria, Apr. 2015, pp. 1–10.
S. Thrun and M. L. Littman, "Reinforcement Learning: An Introduction," AI Magazine, vol. 21, no. 1, pp. 103–103, Mar. 2000.
R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction. 2nd ed.Cambridge, MA, USA: MIT Press, 2018.
A. Usman, M. M. Boukar, M. A. Suleiman, I. A. Salihu, and N. O. Eke, "Reinforcement Learning for Testing Android Applications: A Review," in 2023 2nd International Conference on Multidisciplinary Engineering and Applied Science (ICMEAS), Abuja, Nigeria, Nov. 2023, vol. 1, pp. 1–6.
N. Mazyavkina, S. Sviridov, S. Ivanov, and E. Burnaev, "Reinforcement learning for combinatorial optimization: A survey," Computers & Operations Research, vol. 134, Oct. 2021, Art. no. 105400.
H. van Seijen, H. van Hasselt, S. Whiteson, and M. Wiering, "A theoretical and empirical analysis of Expected Sarsa," in 2009 IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning, Nashville, TN, USA, 2009, pp. 177–184.
L. Mariani, M. Pezzè, O. Riganelli, and M. Santoro, "AutoBlackTest: a tool for automatic black-box testing," in Proceedings of the 33rd International Conference on Software Engineering (ICSE11), Honolulu, HI, USA, May 2011, pp. 1013–1015.
A. Esparcia-Alcazar, F. Almenar, M. Martınez, U. Rueda, and T. E. J. Vos, "Q-learning strategies for action selection in the TESTAR automated testing tool: 6th International Conference on Metaheuristic and Nature inspired Computing," in Proceedings of the 6TH International Conference on Metaheuristics and Nature Inspired Computing META’2016, Marrakech, Morocco, 2016, pp. 174–180.
M. K. Khan and R. Bryce, "Android GUI Test Generation with SARSA," in 2022 IEEE 12th Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, NV, USA, Jan. 2022, pp. 0487–0493.
A. Rosenfeld, O. Kardashov, and O. Zang, "ACAT: A Novel Machine-Learning-Based Tool for Automating Android Application Testing," in Hardware and Software: Verification and Testing, Haifa, Israel, 2017, pp. 213–216.
Y. Koroglu et al., "QBE: QLearning-Based Exploration of Android Applications," in 2018 IEEE 11th International Conference on Software Testing, Verification and Validation (ICST), Vasteras, Sweden, Apr. 2018, pp. 105–115.
Y. Gao, C. Tao, H. Guo, and J. Gao, "A Deep Reinforcement Learning-Based Approach for Android GUI Testing," in Asia-Pacific Web (APWeb) and Web-Age Information Management (WAIM-2022) Joint International Conference on Web and Big Data, Nanjing, China, Aug. 2022, pp. 262–276.
H. Yasin, S. H. A. Hamid, and R. J. R. Yusof, "DroidbotX: Test Case Generation Tool for Android Applications Using Q-Learning," Symmetry, vol. 13, Feb. 2021, Art. no. 310.
T. Gu et al., "AimDroid: Activity-Insulated Multi-level Automated Testing for Android Applications," in 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME), Shanghai, China, Sep. 2017, pp. 103–114.
"Write automated tests with UI Automator," Android Developers. [Online]. Available: https://developer.android.com/training/testing/other-components/ui-automator.
"F-Droid - Free and Open Source Android App Repository." [Online]. Available: https://f-droid.org/.
"JaCoCo Java Code Coverage Library." [Online]. Available: https://www.eclemma.org/jacoco/.
"coverage: Code coverage measurement for Python." [Online]. Available: https://github.com/nedbat/coveragepy.
"EMMA: a free Java code coverage tool." https://emma.sourceforge.net/.
M. Pan, A. Huang, G. Wang, T. Zhang, and X. Li, "Reinforcement learning based curiosity-driven testing of Android applications," in Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, Apr. 2020, pp. 153–164.
Downloads
How to Cite
License
Copyright (c) 2024 Asmau Usman, Moussa Mahamat Boukar, Muhammed Aliyu Suleiman, Ibrahim Anka Salihu
This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.