diff --git a/README.md b/README.md index f352291..08a2eed 100644 --- a/README.md +++ b/README.md @@ -4,28 +4,29 @@ Docker-Android [![Build Status](https://travis-ci.org/butomo1989/docker-android.svg?branch=master)](https://travis-ci.org/butomo1989/docker-android) [![codecov](https://codecov.io/gh/butomo1989/docker-android/branch/master/graph/badge.svg)](https://codecov.io/gh/butomo1989/docker-android) -Android in docker solution with noVNC supported +Docker-Android is an android environment, an android emulator that facilitates different devices and [appium] in docker solution integrated with noVNC. -Requirements ------------- - -Docker is installed in your system. +Samsung Device | Google Device +:---------------------------:|:---------------------------: +![][docker android samsung] | ![][docker android nexus] Purpose ------- -1. Build android project / application and run unit test -2. Run UI Test for mobile website with appium framework -3. Run UI Test for mobile application with different frameworks (appium, espresso, etc.) -4. Simulate Short Message Service (SMS) +1. Build android project and run unit test inside container +2. Run UI Test for mobile application with different frameworks (appium, espresso, etc.) +3. Run UI Test for mobile website with appium test framework +4. Video recording to analyse failing test cases ***(soon)*** +5. Monkey test for stress test ***(soon)*** -Features --------- +Advantages compare with other docker-android projects +----------------------------------------------------- -1. Android emulator with different devices -2. latest build-tool (version 25.0.2) -3. noVNC to see what happen inside docker container -4. Appium server for automation test framework and it is able to connect with selenium grid +1. noVNC to see what happen inside docker container +2. Android emulator that facilitates different devices +3. Able to connect with selenium grid +4. Able to control emulator from outside container by using adb connect +5. It will have more important features for testing purpose like video recording and monkey test ***(soon)*** List of Docker images --------------------- @@ -43,23 +44,39 @@ List of Docker images |OSX / Windows|7.0|24|butomo1989/docker-android-arm-7.0|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-arm-7.0.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-7.0 "Get your own image badge on microbadger.com")| |OSX / Windows|7.1.1|25|butomo1989/docker-android-arm-7.1.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-arm-7.1.1.svg)](https://microbadger.com/images/butomo1989/docker-android-arm-7.1.1 "Get your own image badge on microbadger.com")| +List of Devices +--------------- + +Type | Device Name +----- | ----- +Phone | Samsung Galaxy S6 +Phone | Nexus 4 +Phone | Nexus 5 +Phone | Nexus 5x +Phone | Nexus 6 +Phone | Nexus 6P +Phone | Nexus One +Phone | Nexus S +Tablet | Pixel C +Tablet | Nexus 7 +Tablet | Nexus 9 +Tablet | Nexus 10 + +Requirements +------------ + +Docker is installed in your system. + Quick Start ----------- -1. Enable **Virtualization** under **System Setup** in **BIOS**. (It is only for Ubuntu OS. If you use different OS, you can skip this step). - -2. Run docker-android +1. Run docker-android ```bash - docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-5.0.1 + 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 ``` - **Optional arguments** - - -v :/root/tmp : You need to share volume or apk file if for example you want to build the android project inside docker container or you want to run UI test by using appium. - -e APPIUM=True: If you want to use appium as UI test framework to test mobile website or android application - -3. Verify the ip address of docker-machine. +2. Verify the ip address of docker host. - For OSX, you can find out by using following command: @@ -69,45 +86,41 @@ Quick Start - For different OS, localhost should work. -4. Open ***http://docker-machine-ip-address:6080*** from web browser. +3. Open ***http://docker-machine-ip-address:6080*** from web browser. - ![][noVNC] +Run Appium Server +----------------- +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***. -Connect to Selenium Grid ------------------------- +```bash +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 +``` -This feature can be used only if you set **APPIUM=True** in environment variable. +### Connect to Selenium Grid -**Arguments** +![][selenium grid] +![][devices are connected with selenium grid] - -e CONNECT_TO_GRID=True : to connect appium server to your selenium grid. - -e APPIUM_HOST="": where / on which instance appium server is running. Default value: 127.0.0.1 - -e APPIUM_PORT=: which port appium server is running. Default port: 4723 - -e SELENIUM_HOST="": where / on which instance selenium grid is running. Default value: 172.17.0.1 - -e SELENIUM_PORT=: which port selenium grid is running. default port: 4444 +It is also possible to connect appium server that run inside docker-android with selenium grid by passing following environment variables: -![][connect to grid 1] ![][connect to grid 2] +- CONNECT\_TO\_GRID=True +- APPIUM_HOST="\" +- APPIUM_PORT=\ +- SELENIUM_HOST="\" +- SELENIUM_PORT=\ -List of Devices ---------------- +```bash +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 +``` -Type | Device Name ---- | --- -Phone | Samsung Galaxy S6 -Phone | Nexus 4 -Phone | Nexus 5 -Phone | Nexus 5x -Phone | Nexus 6 -Phone | Nexus 6P -Phone | Nexus One -Phone | Nexus S -Tablet | Pixel C -Tablet | Nexus 7 -Tablet | Nexus 9 -Tablet | Nexus 10 +### Share Volume -![][galaxy s6] ![][nexus 5] +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***. + +```bash +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 +``` Control android emulator outside container ------------------------------------------ @@ -154,7 +167,7 @@ SMS Simulation docker exec -it android-container adb emu sms send ``` -3. You can also integrate it inside project using [adblib]. +3. You can also integrate it inside project using adb library. ![][sms] @@ -166,11 +179,10 @@ All logs inside container are stored under folder **/var/log/supervisor**. you c docker exec -it android-container tail -f /var/log/supervisor/docker-appium.stdout.log ``` -[noVNC]: "login with noVNC to see what happen inside container" -[connect to grid 1]: -[connect to grid 2]: -[galaxy s6]: -[nexus 5]: +[appium]: +[docker android samsung]: +[docker android nexus]: +[selenium grid]: +[devices are connected with selenium grid]: [adb_connection]: [sms]: -[adblib]: diff --git a/images/appium.png b/images/appium.png deleted file mode 100644 index 0589bb8..0000000 Binary files a/images/appium.png and /dev/null differ diff --git a/images/appium_with_selenium_grid_01.png b/images/appium_with_selenium_grid_01.png deleted file mode 100644 index d291181..0000000 Binary files a/images/appium_with_selenium_grid_01.png and /dev/null differ diff --git a/images/appium_with_selenium_grid_02.png b/images/appium_with_selenium_grid_02.png deleted file mode 100644 index 3eb4907..0000000 Binary files a/images/appium_with_selenium_grid_02.png and /dev/null differ diff --git a/images/connected_with_grid.png b/images/connected_with_grid.png new file mode 100644 index 0000000..43401e9 Binary files /dev/null and b/images/connected_with_grid.png differ diff --git a/images/docker_android_nexus.png b/images/docker_android_nexus.png new file mode 100644 index 0000000..e321b7c Binary files /dev/null and b/images/docker_android_nexus.png differ diff --git a/images/docker_android_samsung.png b/images/docker_android_samsung.png new file mode 100644 index 0000000..d4ad695 Binary files /dev/null and b/images/docker_android_samsung.png differ diff --git a/images/noVNC.png b/images/noVNC.png deleted file mode 100644 index f3db055..0000000 Binary files a/images/noVNC.png and /dev/null differ diff --git a/images/run_under_galaxy_s6.png b/images/run_under_galaxy_s6.png deleted file mode 100644 index 7515474..0000000 Binary files a/images/run_under_galaxy_s6.png and /dev/null differ diff --git a/images/run_under_nexus_5.png b/images/run_under_nexus_5.png deleted file mode 100644 index b9ade69..0000000 Binary files a/images/run_under_nexus_5.png and /dev/null differ diff --git a/images/selenium_grid.png b/images/selenium_grid.png new file mode 100644 index 0000000..0c9efc6 Binary files /dev/null and b/images/selenium_grid.png differ