Saturday 14 September 2019

Setting up Genymotion with Oracle Virtual Box for Android Automation





In this tutorial, we will see how to setup Genymotion with Oracle Virtual Box for Android automation.


Prerequisites:

  • Appium must be installed in your mac machine. To check the version and verify Appium is installed or not. Go to terminal and type: appium and press return key. It should show Welcome message and show REST HTTP interface is listening on 4723 port which is default port for appium.

[Appium] Welcome to Appium v1.14.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723


What is Android Emulator?

Emulator emulates real device software, hardware, and Operating System. They fulfill the need to test Applications under test against different versions of android.

The need for Android Emulator?

We need Android Emulator to test our application on different versions of android.

Creation of Android Emulator

For this demonstration, we will use Genymotion instead of the Android SDK emulator, as Genymotion is reliable, simple, easy to use. It also supports GPS and wifi connectivity in real-time.

So let's get started.....


  1. Go to the Application folder and open Genymotion. On the first time when you open it, you don't have virtual devices added to Genymotion.
  2. To add a virtual device you need to sign with the genymotion account created. On successful login, it will communicate with the cloud and list down all virtual devices. You can choose devices depending on your preferences.
  3. Set environment variables in your bash_profile file present under your home directory.
cd /Users/user.name
edit existing ./bash_profile file and create and then add the following lines in this file.

export PATH=$PATH:/Users/user.name/Library/Android/sdk/platform-tools/
export ANDROID_HOME=/Users/user.name/Library/Android/sdk/
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH

4. Set Android SDK path in GenyMotion,
Go to Genymotion-->Preferences-->select ADB in setting tab, and provide path of Android SDK folder in Android SDK under "use Custome Android tools"




5. Select the device in Genymotion. For example, I have selected these 3 devices. You can start the device from as,

The same device will be available in Oracle Virtual Box.


After clicking on start option the selected device will be up as follows:



So now you can navigate through virtual device manually or through your appium based automation script. 

Please share, comment if you like this tutorial and will add more tutorials in this space. Thanks and Happy Learning !!

3 comments:

  1. Thanks @Prateek for detailed information.

    It was ease to setup the env. by following the above mentioned instructions.

    Great stuff for the needy ones.

    ReplyDelete
  2. Great Content. very Helpful!!

    ReplyDelete

Setting up Genymotion with Oracle Virtual Box for Android Automation

In this tutorial, we will see how to setup Genymotion with Oracle Virtual Box for Android automation. Prerequisites: Appium must ...