Abstract:With the rapid increase in the number of Android applications, more importance is attached to the quality of Android applications. Testing is an important guarantee for high-quality software, and test case generation technology is the key to automated testing. Data shows that nearly 88% of Android applications in Google Play use reflection. The existing automatic test case generation methods for Android, however, usually do not consider the use of reflection and cannot detect the malicious behavior hidden by reflection. To further improve software quality, this study proposes a new test case generation method for Android, which uses reflection features to construct a multi-grain model of Android applications. Meanwhile, it analyzes reflection relationships to generate call paths that can reach reflection and employs the adaptive genetic algorithm to generate test cases that cover reflection paths to test Android applications with reflection features. For verification, the effectiveness of this method is evaluated in terms of the effectiveness of the multi-grain model of Android applications and the efficiency of the test method. The experimental results reveal that the automatic test case generation method for Android, which is based on reflection features, is more effective and efficient in detecting reflection.