Test automation can support continuous mobile software development by reducing manual testing efforts, minimizing human errors, and accelerating the release cycle. Burak Ergören shared his experiences from automating their mobile testing at QA Challenge Accepted 2023.
Ergören mentioned that with the test automation project, they intended to boost the code coverage percentage and initiate tests at their convenience, ensuring a more comprehensive and efficient testing process:
By implementing parallel running tests, we gain the ability to detect errors at an earlier stage in the development process. This empowers us to run automation tests designed for various purposes concurrently.
Selecting the right testing tool is crucial, Ergören said. They opted for Appium, an open-source test automation project compatible with both Android and iOS platforms, which supports multiple programming languages, such as Java and JavaScript.
The next step was defining the project’s scope, as Ergören explained:
The project’s scope should encompass essential features, common functions, and complex test cases.
In the following step, they designed the test automation architecture, choosing Java as their language of choice. They emphasized adherence to Object-Oriented Programming (OOP) principles, incorporating design patterns like the Page Object Model and Factory Design Pattern. Ergören mentioned that to establish a robust and flexible project architecture, they ensured the integration of concepts such as clean code and SOLID principles.
The subsequent steps involved preparing and maintaining automated tests, which they reviewed and continued to analyze.
As the number of tests and the complexity of scenarios increased, the total runtime of their mobile automated test suite started to become unmanageably long. They found themselves consistently exceeding their release process deadlines.
Ergören mentioned that, in their pursuit of optimizing and expediting the release cycle, they started by tackling test synchronization:
We eliminated nearly all instances of "thread.sleep" in our project by creating a generic wait method using the Fluent WebDriver and thoroughly refactoring the entire project.
They also prioritized refining their locator options, by minimizing the use of XPath and emphasized the use of IDs. Collaborating with developers, they made it a standard practice to include IDs for all newly developed UI elements, Ergören said.
Repeating actions like entering a username, password, and clicking "login" incurred unnecessary time costs. Ergören mentioned that they recognized the repetitive nature of common methods, such as the login process, across many of our automated tests. To expedite this process, they implemented a solution: when the application initially launches, it logs in with predefined test user data, resulting in significant time savings.
Optimizing the release cycle they identified certain test cases that required navigating through lengthy pathways to access specific screens:
We implemented deep link development, allowing direct access to the relevant page within the project. This optimization resulted in considerable time savings.
InfoQ interviewed Burak Ergören about mobile test automation.
InfoQ: How did the situation look before you started your mobile test automation project?
Burak Ergören: We only had a manual testing process, where step-by-step checks were conducted using the test case checklist prepared by mobile QA engineers. We attempted to verify the manual testing process on various device versions, but it was quite time-consuming.
Our biggest problem was that when we encountered critical errors in the final stages of the manual testing checklist, the process could come to a halt, and have to start over.
InfoQ: What have you learned?
Ergören: Developing a mobile test automation project demands considerable time and dedication. Mobile automation is more challenging compared to web automation.
Factors such as the stability of mobile devices, network connectivity, and the ongoing maintenance of servers connected to these devices require substantial effort and time.
In this context, tasks like monitoring version updates and seamlessly integrating them into the project, minimizing flaky test cases, and ensuring regular maintenance are pivotal in maintaining the project’s stability.
We all experience the ebb and flow of daily life; there are times when we may struggle to maintain focus on our work, leading to potential mistakes. Automation, devoid of human emotions, faithfully follows the directives we provide.