I’m building a mobile app. Why do I need to test?

I’m building a mobile app. Why do I need to test?

I started coding professionally while I was in University and decided to learn with java. During that time, I also got into Android development and I was loving it. It was a good start. Creating my first “Hello World” Android application was a big deal then. I started building practice apps and I was learning “fast”. Or so I thought?

Getting ready for my Google Associate Android Developer (AAD) exam changed a lot. I got to learn about other things that contribute to the entire success of the app. One of them being Testing.

 

Why does one need to test?

As the app scales, we might include more features in our application: fetching data from the cloud, real time functionality, accessing local storage, scheduling jobs and even more. Testing would make it clear that your application still meets its requirements as it should. A good way to start when developing a new feature is to write a test. It’s important to test for every possible scenario in that unit including standard interactions, invalid inputs, and cases where resources aren’t available. These would obviously fail at first because implementation hasn’t been done. But the idea is not to go off the requirements and this is the surest way to help stay within the boundary.

 

What if the tests fail?

To be honest, failing tests are nothing to be sad or mad about. Its all about patience. Also, it is an iterative process. I once did a hacker rank problem-solving challenge. It seemed easy. On submission of my code, 5 out of 11 test cases passed. Over time, I got to understand that some approaches may not work for some scenarios so it helps to understand the feature to be developed and what works.

 

Now I know I should write tests. How do I do this for my mobile app?

There are three categories of tests: small, medium and large.

  • Small tests are unit tests that you can run in isolation from production systems. They typically mock every major component and should run quickly on your machine. These run really fast but are not as certain as large tests. Therefore, passing a test does not guarantee that the app works.
  • Medium tests are done after running unit tests to verify that the components behave properly when put on an actual device or emulator. Examples of medium tests are integration tests. It is recommended to perform medium tests on emulators to enable one check the application on different phone types, configurations and screen sizes (if you don’t have access to multiple devices).
  • Large tests involve testing common workflows and use cases that involve the complete stack, from the UI through business logic to the data layer.

Now you know about the three categories of tests, or what is called the Testing Pyramid. In Android, there are different testing frameworks to help in this process:

  • Espresso and UI Automator can be used for UI tests
  • JUnit is also a unit testing framework
  • Appium is a mobile test automation framework (and tool) for native, hybrid and web apps for iOS and Android.
  • KotlinTest is a test framework for Kotlin
Owonikoko David

Programmes Officer for Promotion of French Higher Education @ Campus France Nigeria | M.A. French & Philomath

5 年

I feel inspired with this profile.

EZE CHIDEBELU DANIEL

Software Developer at Gloxina Global Nigeria Ltd

5 年

Wow... I'm so thrilled to see this article. this is so hilarious for me. I feel so pumped and highly motivated to venture full-time into this world of Software Engineering. Although, I have had so many drawbacks due to lack of finances and access to the relevant information and IT community who can support. But, you Adaora, reading your article I'm so motivated now and I'm now determined to do whatever it takes to reach the peak of this industry against all odds. Thanks for being an inspiration to me.

Eghosa Quesnel MSc, CFA Level 1 Passed

Big Data & Predictive Analytics | Fraud Analytics Professional

5 年

Keep up the good work.

要查看或添加评论,请登录

Adora Nwodo的更多文章

  • Artificial Intelligence. A Necessity

    Artificial Intelligence. A Necessity

    Artificial intelligence (AI) is an area of computer science that emphasizes the creation of intelligent machines that…

社区洞察

其他会员也浏览了