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.
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.
- adb root
- adb pull /etc/hosts hosts
- adb remount
- 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.
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.