Comparison of GUI Testing Tools for Android Applications
Total Page:16
File Type:pdf, Size:1020Kb
Comparison of GUI testing tools for Android applications University of Oulu Department of Information Processing Science Master’s Thesis Tomi Lämsä Date 22.5.2017 2 Abstract Test automation is an intriguing area of software engineering, especially in Android development. This is since Android applications must be able to run in many different permutations of operating system versions and hardware choices. Comparison of different tools for automated UI testing of Android applications is done in this thesis. In a literature review several different tools available and their popularity is researched and the structure of the most popular tools is looked at. The two tools identified to be the most popular are Appium and Espresso. In an empirical study the two tools along with Robotium, UiAutomator and Tau are compared against each other in test execution speed, maintainability of the test code, reliability of the test tools and in general issues. An empirical study was carried out by selecting three Android applications for which an identical suite of tests was developed with each tool. The test suites were then run and the execution speed and reliability was analysed based on these results. The test code written is also analysed for maintainability by calculating the lines of code and the number of method calls needed to handle asynchrony related to UI updates. The issues faced by the test developer with the different tools are also analysed. This thesis aims to help industry users of these kinds of applications in two ways. First, it could be used as a source on what tools are over all available for UI testing of Android applications. Second, it helps potential users of these kinds of tools to choose a tool that would suit best their needs, depending on if they are most interested on test execution speed or in the easiness of developing a reliable test suite. The results of this study are the first benchmarking of these Android UI testing tools. From this thesis one can see how a few of the tools available fare up against each other in a small-scale study. Tau and Espresso share the first place in maintainability, since Tau requires the least amount of lines of code, but Espresso requires no waiting method calls to ensure synchronization of the UI. While Tau faced least general issues during the test suite development, Espresso is clearly the fastest of the tools and it attains highest level of reliability, so it seems to be the best choice of the tools. Keywords Software Testing, UI testing, Android, Test Automation, Appium, Espresso, Robotium, Tau, UiAutomator Supervisor D.Sc. Professor Mika Mäntylä 3 Foreword I want to thank my thesis supervisor Mika Mäntylä for his great patience, his guidance during my work for this thesis and that he at a times pushed me to continue this work so that it is finally finished at this point. I would also like to thank him greatly for the opportunity to work on this thesis, since it was he who had the general idea in mind when he inquired if I wished to work on it. Without him I would have never worked on this subject. I’d also like to thank the University of Oulu and my department for providing me a chance to study in there and learn much more of the world. A word of thank you should also go to Miikka Kuutila and Päivi Raulamo-Jurvanen for their help in making the long summer during which I worked on this thesis go much faster and for their hints and help while I worked with this. Thanks to my family without whom I would not be where I am now, and finally a big thank you to Ilona Myyri, without whom my life would be a lot bleaker. 4 Contents Abstract ............................................................................................................................. 2 Foreword ........................................................................................................................... 3 Contents ............................................................................................................................ 4 1. Introduction .................................................................................................................. 6 2. Prior Research .............................................................................................................. 9 2.1 Android applications ............................................................................................ 9 2.2 GUI testing ........................................................................................................... 9 2.2.1 GUI testing on Android .......................................................................... 10 2.3 Android GUI testing tools and libraries (RQ 1.1) ............................................. 11 2.3.1 Android testing tools in articles and blogs ............................................. 11 2.3.2 Closer look at the tools available for Android GUI testing .................... 13 2.4 How do the tools rank in popularity? (RQ 1.2) ................................................. 16 2.4.1 Tool popularity in Google trends ........................................................... 16 2.4.2 Tool popularity in Stack overflow .......................................................... 18 2.4.3 Which are the most popular tools ........................................................... 20 2.5 Architecture of the popular tools (RQ 1.3) ........................................................ 20 2.6 Automatic test generation for Android (RQ 1.4) ............................................... 26 3. Methodology .............................................................................................................. 30 3.1 Research methods .............................................................................................. 30 3.2 Research questions ............................................................................................. 31 3.2.1 Research Question 1 ............................................................................... 32 3.2.2 Research Question 2 ............................................................................... 33 3.3 Empirical research ............................................................................................. 35 3.3.1 Applications chosen for evaluating the testing tools/libraries ................ 36 3.3.2 Devising the test set ................................................................................ 38 3.3.3 Running the test set ................................................................................ 43 3.3.4 Test run environment .............................................................................. 43 4. Findings ...................................................................................................................... 45 4.1 General findings and sources of difficulty for the tools (RQ 2.1) ..................... 45 4.1.1 General points of problem ...................................................................... 45 4.1.2 Issue severity per tool ............................................................................. 47 4.2 Execution times (RQ 2.2) .................................................................................. 51 4.3 Maintainability (RQ 2.3) .................................................................................... 61 4.3.1 Lines of Code ......................................................................................... 61 4.3.2 Number of waits ..................................................................................... 63 4.4 Reliability (RQ 2.4) ........................................................................................... 64 4.4.1 Failures in the Notes test suite ................................................................ 66 4.4.2 Failures in Amaze test suite .................................................................... 66 4.4.3 Failures in Wikipedia test suites ............................................................. 67 4.5 Ranking of the tools ........................................................................................... 69 5. Discussion and Implications ....................................................................................... 73 5.1 Encountered issues while developing the test sets (RQ 2.1) ............................. 73 5.2 Execution times (RQ 2.2) .................................................................................. 74 5.3 Maintainability (RQ 2.3) .................................................................................... 76 5.4 Reliability (RQ 2.4) ........................................................................................... 78 5.4.1 A look at the tests that fail ...................................................................... 79 5.4.2 Costs related to failures .......................................................................... 81 5.5 Tool rankings ..................................................................................................... 81 6. Conclusions ................................................................................................................ 83 5 6.1 Limitations ......................................................................................................... 83 6.2 Further research ................................................................................................. 84 7. Acknowledgements .................................................................................................... 86 References ......................................................................................................................