Docker-Android is an android environment, an android emulator that facilitates different devices and appium in docker solution integrated with noVNC.
Samsung Device | Google Device |
---|---|
- Build android project and run unit test inside container
- Run UI Test for mobile application with different frameworks (appium, espresso, etc.)
- Run UI Test for mobile website with appium test framework
- Video recording to analyse failing test cases (soon)
- Monkey test for stress test (soon)
- noVNC to see what happen inside docker container
- Android emulator that facilitates different devices
- Able to connect with selenium grid
- Able to control emulator from outside container by using adb connect
- It will have more important features for testing purpose like video recording and monkey test (soon)
Type | Device Name |
---|---|
Phone | Samsung Galaxy S6 |
Phone | Nexus 4 |
Phone | Nexus 5 |
Phone | Nexus One |
Phone | Nexus S |
Tablet | Nexus 7 |
Docker is installed in your system.
-
Run docker-android
-
For Linux OS, please use image name that contains "x86"
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-7.1.1
-
For OSX and Windows OS, please use image name that contains "arm"
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-arm-7.1.1
-
-
Verify the ip address of docker host.
-
For OSX, you can find out by using following command:
docker-machine ip default
-
For different OS, localhost should work.
-
-
Open http://docker-host-ip-address:6080 from web browser.
Appium is automation test framework to test mobile website and mobile application, including android. To be able to use appium, you need to run appium-server. You run appium server inside docker-android container by opening port 4723 and passing an environment variable APPIUM=TRUE.
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e DEVICE="Samsung Galaxy S6" -e APPIUM=True --name android-container butomo1989/docker-android-x86-7.1.1
It is also possible to connect appium server that run inside docker-android with selenium grid by passing following environment variables:
- CONNECT_TO_GRID=True
- APPIUM_HOST="<host_ip_address>"
- APPIUM_PORT=<port_number>
- SELENIUM_HOST="<host_ip_address>"
- SELENIUM_PORT=<port_number>
docker run --privileged -d --rm -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e APPIUM=True -e CONNECT_TO_GRID=True -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-7.1.1
If you want to use appium to test UI of your android application, you need to share volume where the APK is located to folder /root/tmp.
docker run --privileged -it --rm -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v $PWD/example/sample_apk:/root/tmp -e DEVICE="Nexus 5" -e APPIUM=True -e CONNECT_TO_GRID=True -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-7.1.1
adb connect <docker-machine-ip-address>:5555
Note: You need to have Android Debug Bridge (adb) installed in your host machine.
-
Using telnet
- Find the auth_token and copy it.
docker exec -it android-container cat /root/.emulator_console_auth_token
- Access emulator using telnet and login with auth_token
telnet <docker-machine-ip-address> 5554
- Login with given auth_token from 1.step
auth <auth_token>
- Send the sms
sms send <phone_number> <message>
-
Using adb
docker exec -it android-container adb emu sms send <phone_number> <message>
-
You can also integrate it inside project using adb library.
All logs inside container are stored under folder /var/log/supervisor. you can print out log file by using docker exec. Example:
docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log