Testing in Android: how to develop a strategy that suits you

Tags: androidtesting, datadriventesting, mobiletesting, testing
Published: 2021-06-22 09:18:11

Google play store hosts close to [3 million android applications] (https://www.statista.com/statistics/266210/number-of-available-applications-in-the-google-play-store/) on its platform as of Dec 2020. As for me, it looks like there is an application for everything today, especially on the Android operating system. 

When such a large number of options exist for a user, in the application part or in other fields, the user’s selection standards begin to improve. 

It becomes a bit hard to sacrifice or adjust according to the application when someone tells you one more application with the same features and other anticipated features too. 

As a result, the burden comes onto the testers to stamp the application only after exhaustive and satisfactory testing. But testing in android is not a standard textbook rule guide. 

A new application brings out new challenges and requires newer solutions. Therefore the best method is to develop a testing strategy that you are most comfortable with, or if I may rephrase, the one that suits you.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lek80zt6rieywsaz3lq0.png)

Source: [Raywwenderlich] (https://www.raywenderlich.com/12678525-testing-android-architecture-components)

This post will highlight the larger picture to help you shape the steps to build an android app testing strategy for better testing. 

##Organize the code

The first step to understand is to organize the code in a single place. Organizing the code is extremely important as it gives you a better understanding of the direction in which you need to move forward. 

If extensive data is required then collect that data into sheets for [data-driven testing] (https://testsigma.com/data-driven-testing). If local storage data is required or if sensor data is required then make the necessary arrangements. 


##Test execution on the most suitable platform

Prior to writing the automation test scrips and building up scenarios, it is important to decide how we are going to test our android application. At first, it may seem that if you have experience in doing it the “X” way, it is always better. In reality, it is a better method but not a better strategy and definitely not a way to move ahead as a “tester”. 

The test cases for android applications can be executed in one of three ways: 
i. On real devices
ii. On cloud-based test automation tools
iii. On simulators and emulators

Going ahead with the real devices is the most efficient method but also most expensive in maintenance, time, and costs of operations. Simulators and emulators are the cheapest methods but do not give the exact performance outputs of the real devices. 

The third option is to go with cloud-based tools. Cloud-based tools have improved significantly in the past 7-10 years and host both real devices and emulators without the need of maintaining the infrastructure.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4mt273weucim0hqr39oq.png)

Source: [Bitbar] (https://bitbar.com/blog/what-is-a-real-device-cloud-and-why-use-one-for-mobile-app-testing/)

There are many tools available online today. One of them is [Testsigma] (https://testsigma.com/) that is trusted by multiple multi-national organizations. Also, uses real devices which gives a tester an added advantage of testing on real devices without purchasing one.

Testsigma also uses the [English language (NLP)] (https://testsigma.com/blog/natural-language-processing-nlp-based-test-automation/) to construct its tests which is easier. As a tester, it suits the perfect strategy for testing android applications of any type. Hence, a free trial is a must-try to test our hands on the software.



##Which type of tests to go for?

The next part of a suitable strategy building is to select which type of tests to put our focus on. Since a lot of the android applications deal with data communication within the modules, a lot of the people speak about unit testing and functional testing as the utmost priority for every tester. 

Practically, all types of tests play some part in the smooth functioning of the application. But, focusing on one type of test every time is not a good strategy.

For example, if I am developing an android application for financial services, maybe a bank, then security testing is of the highest importance. The bank may let go of a couple of application crashes but hacking into the system can be a huge loss. 

What if I am developing a calculator or a to-do type of application? Security testing is now of least importance. So, the strategy that will suit you when you start the testing process will be to sort the tests in priority with main areas of focus and write test cases and scenarios accordingly.


 
##Deciding approach and tools

Testing an android application gives us two popular approaches: [test-driven development] (https://en.wikipedia.org/wiki/Test-driven_development) and [behavioral driven development] (https://en.wikipedia.org/wiki/Behavior-driven_development). Both of the approaches are equally popular and equally efficient in nature. 

Just a small difference is that BDD invites non-technical people such as business analysts and clients to involve in test creation while TDD is technical. Although they do bring differences in the way testing is done. 

Your perfect strategy can include any of the two methods here and the recommended is the one you feel best. Sometimes the application will favor TDD a bit and sometimes BDD but with small adjustments, you can move ahead with any of them.


##Implement use cases based on test pyramid

The final step to consider in developing a perfect suitable strategy for testing in android is the type of tests we are considering and their impact on the use cases. As the Google Testing blog mentions, tests can be written among one of the three types: small tests, medium tests, and large tests.

These tests are also equated loosely to unit tests, integration tests, and end-to-end tests. A good strategy calculates beforehand about which tests have to be written more and which one impacts what use cases. Sorting them out and including them in the testing plan is the best way to move ahead.



##Conclusion

Testing in Android is becoming a refined skill more than ever. A large number of devices are floating in the market hungry for applications aiming to make user’s life easier. This process has given the most responsibility to a tester whose job is to make sure the application never upsets the user performance-wise. 

In addition, it should work as expected and should garner positive reviews on the application store. While I can say that standard rules might apply to other types of tests, testing in android takes a chunk of your time in just devising the perfect strategy.

As a bottom line, we cannot do what is best for us but focus on what is best for the application. This post was all about the steps you should take to construct the strategy for testing in android. 

A strategy that in the actual testing phase will suit you and bring about the best possible outputs. In addition to the points stated above, you can also strategize on the teams involved and what libraries best suit you. 

I hope this post will play some part in your next android application testing. For any suggestions, you can comment below!