Appium CI with Genymotion - How to deal with unpredictable Genymotion start time?

In the CI env, Genymotion sometimes gets stuck in a blank screen. If it does start, the start time varies. Did anyone face this issue when setting up the Android CI tests? How did you work around this issue in your Jenkins script?

Yup, we saw some similar things. Basically, we had to make sure no other virtualbox processes are running before launching the emulator.

Here are some relevant clippings from our shell scripts for launching emulators (note examples are from OSX):

#kill genymotion emulators before starting a new one
echo "[INFO] Killing Genymotion emulators..."
ps aux | grep "" | awk '{print $2}' | xargs kill

# kill virtualbox processes 
echo "[INFO] Killing Virtualbox processes to prevent 'black death screen of mystery' (BDSM)..."
killall VBoxHeadless
killall VBoxSVC
killall VBoxNetDHCP

Function for detecting when the emulator has launched:

waitForOS () 
        printf "Waiting for OS to load"
        while [ $timer -le $timeout ] ; do
            printf "."
            # get boot status. Looking for 'stopped' status
            boot_status=`$ANDROID_HOME/platform-tools/adb shell getprop init.svc.bootanim 2> /dev/null`
            #exit if status is 'stopped'
            if [[ "$boot_status" == *stopped* ]] ; then
                curr_time=`date +"%s"`
                delta=`expr $curr_time - $prev_time`
                echo "\nEmulator started in approximately $delta secs"
                exit 0
            sleep 1
            timer=`expr $timer + $retry_interval`
1 Like

Thanks so much for sharing the script. I’ll try this next week.

After killing virtualbox processes, the new instance of Genymotion has no internet connection. Did you encounter this issue?