Mobile App Development
Automated Testing in Android:
Optimizing Application Quality
Krystian Rusek, ANDROID Developer
In this article, I share my experience as a Mobile Developer, focusing on automated testing from a software developer’s perspective. As I have occasionally written or added automated tests, I will primarily discuss the benefits and significance of such tests in the context of mobile application quality.
Introduction: The Role of Automated Tests
Automated tests play a crucial role in the software development process, providing convenience for developers and improving the overall quality of applications. While not always essential, their presence significantly facilitates the early detection of errors.
Faster Error Detection
In many projects, manual testing still prevails when verifying introduced changes. Nevertheless, projects with automated tests offer higher software quality by increasing the speed of error detection and resolution.
For me, as a developer, it is an ideal situation when there are automated tests in the project because when an error occurs, the information about it reaches me quickly, for example, as soon as the next day.
Large Projects Benefit from Automated Tests
Automated tests significantly contribute to high application quality in team projects where more than ten people work on a single codebase. Comparing projects with and without automated tests, I observe differences in the software development process and the ability to release new application versions more quickly.
I have worked on projects with and without automated tests. I noticed that there is a difference in software development. Furthermore, when automated tests are in place, it is possible to release a new version of the application more quickly, as it can reduce manual testing before the release or even eliminate this stage.
Additional Uses of Automated Tests
From my experience, there are instances in projects where we have limited trust in the backend or, for example, have no direct influence over it. In highly complex projects, when analyzing an error, it is sometimes challenging to immediately correlate the issue with the API. Requirements must also be considered. Backend issues often arise in such cases, but, as expected, bugs are reported in the mobile applications.
We introduced automated tests passed through the application’s initial layer of the REST API. This allowed us to quickly pinpoint a bug if it occurred not on the Mobile Application side but within the backend.
Tools for Automated Testing
The easiest to use is Android Espresso. This type of testing is often applied to databases. It is simple to write a test for the queries we need. Even if the automatons are not initiated on CI, it facilitates code writing, allowing for quick checks and testing for any bugs related to the database.
In one project, I also encountered Selenium tests for Android. The project was extensive and demanding. Comprehensive system tests were conducted, meaning that a single codebase was used to test both the website and the Android application. This was necessary because the tests assessed how a particular change impacted the status of Android. It was one of the most intriguing solutions I could collaborate on. I added or modified tests during the project as part of my assistance.
Limits of Automated Tests
Some elements cannot be tested, or it isn’t easy. For example, making and receiving calls. Theoretically, it is possible but very challenging to accomplish in practice. Unfortunately, such elements need to be tested manually, but minimizing the need for manual testing is possible.
In summary, automated tests are a significant component of the software development process, particularly in mobile projects. Their effective application improves application quality while accelerating the release cycle of new versions.