After we talked in the previous parts about Code Libraries vs. Frameworks, and after understanding the world of web development, it’s time to talk about the world of mobile as well 📱
In this chapter, we are going to dive into the development tools available for product developers of mobile devices in Android and iOS. In fact, we will focus on the three most popular to date: React Native, Flutter, & Xamarin. In addition, we will understand what tools are available to us (automation developers) for writing automated tests.
Table of Contents –The Mindset of Developers: The World of Mobile [Part 3]
- Chapter 1 – The Mindset of Developers: Code Libraries vs. Frameworks
- Chapter 2 – The Mindset of Developers: React vs. Vue
- You’re here → Chapter 3 – The Mindset of Developers: The World of Mobile
In the past, to write a mobile app to support both operating systems Android and iOS, we had to write in two different technologies, as can be seen in the following image:
But today, with the new technologies (the ones we will review in this article), we can create our application with the same Code Base on various platforms in the same development environment. Here is a snippet from Google Trends, note the popularity of each of these tools:
One of the best features that this framework has to offer is the Hot Reload which allows developers a quick indication of any change in their code on the device or on the simulator they are working on. Here is an example from back when I wrote my first app in React Native:
Among others, you will find the following applications written by React Native for both the iOS operating system and the Android operating system:
This development kit mainly includes 2 components:
- The SDK is a collection of tools designed to help developers write their code faster (like a compiler that translates the code into the language of the native machine, whether it’s Android or iOS).
- The framework is none other than a collection of code libraries based on so-called widgets, elements in the app like buttons, text fields, sliders, etc..
The third in the group is also the least popular of them. Xamarin is a platform for building mobile applications which was written as open source by Microsoft. Applications in Xamarin can be written in #C in the NET environment (the platform is already embedded in VS 2019). So if the organization is already developing Microsoft-based products, the transition to Xamarin will probably be easy and simple ✅
Although the product does not work so well behind Flutter and React Native, it is still a good product, with a huge customer base and technological backing from one of the largest software companies there is. Here are just a few examples of mobile apps written by Xamarin:
This is where automation comes into the picture
So probably like most automation developers with a little experience, instinctively when you hear “Mobile automation” your head jumps straight to Appium. And that’s fine, the context is pretty clear. There’s a reason this is the most popular framework in the mobile testing world today. But the truth is, while Appium is a very generic tool with advantages and disadvantages, it is possible, recommended, and sometimes even worth considering other options. For example – develop the automation in the same product development environment.
This means: If the developers wrote the app with React Native, why not use the UI Testing Libraries of the development environment? The same goes for Xamarin & Flutter. Or another option, maybe it’s even worth working with the test libraries of the operating system itself (both Android and iOS have such)?
Automation with Native OS Libraries
Under Android-based devices we have the Espresso library, which is very popular. Writing in this library, with the UIAutomator tool (which comes with Android Studio) gives quite a large testing space for apps over Android.
Under iOS-based devices, we have EarlGrey, which is the equivalent of Espresso. When you work with it you also need to work with the XCUITest tool, which already comes Built-in in the XCode development environment.
📍 Here’s an interesting speed benchmark of these and other mobile automation tools: Fastest Mobile Automation Testing Tool – Appium vs. XCUITest vs. TestProject vs. UiAutomator vs. Espresso
Automation with Cross Platform Libraries
What if we are interested in the same automation development environment to cover both Android and iOS? 🤔 In case of developing the application with React Native (reminder – it is possible to develop the application for both types of devices in the same framework), we have the Detox library (developed by Wix) which is popular for E2E testing.
In the case of Flutter, we have the package called test, with code libraries of tests like the flutter test. With the help of the package and libraries we will be able to test Flutter based applications in Dart language in the three layers supported by the framework: Unit tests, Widget tests, and Integration tests.
In the world of Xamarin the situation is not so different, Microsoft has also developed a framework for automated testing over their technology. It comes Built-in in their development environment and is called, of course – Xamarin UITest.
As I already wrote, by default, most organizations turn to Appium as the automation tool for their UI testing over mobile apps. Why? Because it’s the most popular, the most generic, but is it the best tool? As I have already argued in several posts, there is no such thing as “the best”, there is the best for you – for your organization, your team, the technologies you work with.
Happy Mobile Development & Testing ✨