An insight into mobile testing!
Software testing is a way for us to validate the business rules that have been implemented in our code and serve to verify that our software is behaving correctly after a new implementation or even after fixing a bug. While we know the importance of testing our software code. This is still an unknown step or even overlooked by many software developers.
Why mobile testing is tough?
When it comes to developing mobile applications for the android platform, this step becomes even more neglected by software developers, mainly because they have no notion of what to test in a mobile application. This article aims to talk about the environments, recommendations, and types of tests that can be done in a mobile application. It also helps you to know about mobile testing with appium.
Pyramid level of tests
The Test Pyramid shown illustrates how a mobile application should work the three levels of testing, which are: unit(small tests), integration(medium tests), and UI (end-to-end or large tests):
Small-tests are faster to write but have less reliable results than other test levels. What’s more, these types of tests require a large number of test cases that we write. In contrast, large-tests are more costly to write but present more faithful and close results than the user will have. There are several mobile testing code as well.
The environment in which the tests run influences their results because each test can have different results and behaviors. It may be that a local test behaves differently than an instrumented test. On Android, for example, local tests run on the local Java Virtual Machine, while instrumented tests run on Dalvik, Android’s Virtual Machine.
Local (VM): Tests that run directly on the local Virtual Machine. They are faster tests to write and run.
Instrumented (Device): tests that run on the device. In the case of android, these tests run on a virtual machine other than that used in local tests, so they can behave differently.
Types of tests
- Unit test: In this type of test, each small unit of code is tested, without third-party dependency.
- Integration: In this type of test, it is verified whether each unit of the system, when combined with its proper dependencies, works precisely.
- Functional or End-to-end (functional): In this type of test, the entire flow related to the functionality to be tested is validated.
An array of testing possibilities
The following are possible combinations between the types of tests and environments in which they can be run:
Local x Unit: Test each method of a class; validate that the business rules that we implement correctly.
Location x Integration: Test the integration of one or more project classes; on android, it is possible to validate whether one and one, when interacting, cause a certain screen to behave in the correct way.obs.: on android, for this type of test, it is necessary to use the Roboletric library.ActivityViewModel
Instrumented x Unit: Unitarily test each component of a given screen by making assertions and validating the states of each component.
Instrumented x Integration: Test whether a particular screen behaves correctly when interacting with other system components; for example, verify that a request is triggered when a user presses a determining screen button.
Instrumented x Functional: Validate whether a given flow occurs expectedly. Note: This test is usually performed by software quality professionals(QA).
According to Google*, tests in an android app should contain the following division:
Mobile testing: Summing up!
We have several testing possibilities in mobile applications, from unit tests to validate the rules of business that we implement to tests that run directly on a mobile device or emulator validating the entire flow of a feature. Each type of test plays an important role in the development of the system. There are different automation mobile testing tools and mobile testing applications as well. Depending on the nature of the project, recommended divisions may change, all depending on the developer’s common sense.