SQDroid: A Semantic-Driven Testing for Android Apps via Q-learning
Hui Fen Guo, Xiaoqiang Liu, Baiyan Li, Lizhi Cai, Yun Hu, Jing Cao · 2021 IEEE 21st International Conference on Software Quality, Reliability and Security (QRS) · 2021
Android apps are popular in our daily life, while the testing and maintenance of them is still an open challenge. Random-based testing tools are time-consuming and model-based testing tools are unrealistic to construct all functional behaviors precisely. Existing testing tools based on reinforcement learning not only have difficulty in understanding the business logic of an application, but also face the problem of state explosion during testing. In this paper, we propose SQDroid, a semantic-driven approach for Android apps based Q-learning. SQDroid encourages the Q-learning agent to prefer the actions with functional semantics through a dynamic semantic reward function, which is beneficial to the understand business logic of an app. A state clustering module, employed to compress the state space in Q-table, utilizes the widget attributes on GUI hierarchy to abstract a state. It can reduce the number of states in Q-table and avoid the execution of repetitive actions. We evaluate SQDroid on 48 open-source Android apps. The results show SQDroid outperforms the state-of-the-art model-based/search-based technique/reinforcement learning-based Stoat, Sapienz and Q-testing in terms of code coverage and fault revelation.