Mobile Testing with Emulator
Mobile application testing has always been an important part of the overall software development life cycle. As the number of apps increased due to high demand in the tech world and iPhone sales, it is being quite important for the company to make sure that the apps are of utmost quality. To ensure the same, app testing needs to be incorporated for each and every app coming to the app store.
The main part of the app testing process is the devices on which the test is being run, and getting those devices is quite a task. There are basically two main ways of performing app testing either by using real devices or virtual devices. Those virtual devices are basically called emulators.
If we go with real devices, then the company has to buy many devices and has to update them from time to time as new devices hit the market. This expense of testing on real devices was a big challenge that companies have overcome by introducing virtual testing devices or emulators.
What is an Emulator?
Android emulator is a tool that creates virtual Android devices (with both software and hardware). Emulators are very important to perform Mobile Testing; It mimics the hardware and software of the target device on your computer. They do this by translating the ISA (Instruction Set Architecture) of the target device to the one used by the computer you are using to conduct testing using binary translation.
In my ten years of experience, I have observed that when we want to test mobile applications, we always prefer to do the dry run on emulators. In fact, most organisations prefer emulators to run a regression suite for appium testing. So it is quite vital to know about emulators and how to create one for Appium testing.
Prerequisite for Emulator Setup
For the best experience, you should use the emulator in Android Studio on a computer with the following specs:
- 16GB RAM
- 64-bit Windows, macOS, or Linux operating system
- 16GB disk space
If you don’t have these specs, the emulator might still run, but it probably won’t be smooth. That’s why it is advisable to have above system requirements
Download Android Studio
First, make sure that you have Android Studio downloaded on your machine.
It is quite easy to download Android Studio. Click on the link above.
Install Android Studio
To install Android Studio on Windows, proceed as follows:
- If you downloaded an .exe file (recommended), double-click to launch it.
If you downloaded a .zip file, unpack the ZIP, copy the android-studio folder into your Program Files folder, and then open the android-studio > bin folder and launch studio64.exe (for 64-bit machines) or studio.exe (for 32-bit machines).
- Follow the setup wizard in Android Studio and install any SDK packages that it recommends.
To install Android Studio on your Mac, proceed as follows:
- Launch the Android Studio DMG file.
- Drag and drop Android Studio into the Applications folder, then launch Android Studio.
- Select whether you want to import previous Android Studio settings, then click OK.
- The Android Studio Setup Wizard guides you through the rest of the setup, which includes downloading Android SDK components that are required for development.
Open Android Studio and click on “Configure” option, after that select the “ADB Manager” from the list as shown in below screenshot
Now click on “Create Virtual Device” button, you will be redirected to “Select Hardware” page, where we need to select the mobile type, for example “Pixel XL” as shown below, and then click on “Next”
After the “Select Hardware” page you will be able to see the “System Image” page, here we need to select which Android version we want in our mobile device for testing, for example Pie, Oreo, R etc.
In below image you can see that I have selected Android 11, then click on Next:
How to Create Stub with Wiremock for API Testing?
Now you will at “Verify Configuration” page, here you can check the selection we have done in step 3 and step 4, provide the name of your device as I have given the name “Pixel 2 XL API 30” in below screenshot:
Here you can change the Memory and Storage too by clicking on “Show Advanced Settings”, you will get the options as shown below, now click “Finish”
Now the device is created and in the dashboard we can see it, search with the device name that we have provided in Step-05 as shown below, now just click on the Play button and the device is ready for testing 🙂
Once the button “Launch” is clicked you will able to see “Launching Emulator”
Now perform testing by dragging your .apk to the newly created virtual device.
There are many websites that provide the sample apk, which can be used for testing. If you do not have any .apk or .ipa files, you can run your sample tests, you can use the practice apk HERE.
Run and stop an emulator, and clear data
From the Virtual tab, you can perform the following operations on an emulator:
- To run an emulator that uses an AVD, click Launch
- To stop a running emulator, click Menu and select Stop.
- To clear the data for an emulator, select Wipe Data. Or click Menu and select Wipe Data.
Benefits Of Emulator
Cost-Effective: The main benefit of using an emulator is cost-efficiency, as teams can perform mobile testing at a lower cost with emulators since some of them can be downloaded for free on the Internet.
Cross-platform support: Emulators can imitate a wide range of devices and operating systems, enabling teams to easily perform tests on different platforms or required devices. The emulator comes with predefined configurations for various Android phone, tablet, Wear OS, and Android TV devices.
High fidelity: The emulator provides almost all of the capabilities of a real Android device. You can simulate incoming phone calls and text messages, specify the location of the device, simulate different network speeds, simulate rotation and other hardware sensors, access the Google Play Store, and much more.
It’s great to have and use emulators due to cost efficiency, but there are a good amount of risks to consider, which might have an impact . That’s why it’s a good idea to use both – emulators only in initial testing phases to uncover basic bugs and afterward switch to the actual devices to ensure great quality of the test product.
We believe that the best approach to testing is to consider both real and virtual devices, and to analyse risks for each testing phase and product, and also take time and budget limitations into consideration to provide the most reliable and cost-effective testing results.
Now you must be aware of Mobile Testing with Emulators, if you are looking for job opportunities in Mobile Testing or Mobile Automation, then do check out Talent500. Talent500 helps to hire, build & manage globally distributed workforces, and has a large number of career-defining opportunities for tech professionals such as you!