Mobile Application Testing Change Host to Redirect Test Environment


When you need to test the server side development via Mobile application in isolation, you can redirect the host of the API over the hosts file in the emulator. By this way, with the same application that users have, you can test the new development before passing it to live servers.

Android Application

I have using GenyMotion for emulating android devices. You can edit the hosts file in GenyMotion by the following commands, at the third step you need to change `hosts` file then push it emulator.
  1. adb root
  2. adb pull /etc/hosts hosts
  3. adb remount
  4. adb push hosts /system/etc
See the example below, the host of the application is www.morhipo.com which is now hitting the test server. The third step is important, if you don't remount new host file can not be push to device.

~ adb root
adbd is already running as root
~ adb pull /etc/hosts hosts
~ cat hosts
~ echo "10.1.6.37 www.morhipo.com" > hosts
~ cat hosts
10.1.6.37 www.morhipo.com
~ adb remount
remount succeeded
8 KB/s (30 bytes in 0.003s)
~ adb push hosts /system/etc

iOS Application

For iOS simulator, it is simpler just you need is to update the hosts (/etc/hosts) file because the Simulator uses the same host file as in Mac OS.

~ sudo su
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
root@Mesuts-MacBook-Pro /U/mesutgunes# echo "10.1.6.37 www.morhipo.com" > /etc/hosts
root@Mesuts-MacBook-Pro /U/mesutgunes#





Comments

  1. The future of software testing is on positive note. It offers huge career prospects for talented professionals to be skilled software testers. software testing course in Chennai | Software Testing Training in Chennai

    ReplyDelete

Post a Comment

Popular posts from this blog

Selenium Error "Element is not currently interactable and may not be manipulated"

Change Default Timeout and Wait Time of Capybara

Page-Object Pattern for Selenium Test Automation with Python

Performance Testing on CI: Locust is running on Jenkins

How to Set Shared Preferences in Espresso Test for Kotlin and Java