Cleaned up README.md
152
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,57 +44,11 @@ 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")|
|
||||
|
||||
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
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
**Optional arguments**
|
||||
|
||||
-v <android_project_or_apk>:/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.
|
||||
|
||||
- For OSX, you can find out by using following command:
|
||||
|
||||
```bash
|
||||
docker-machine ip default
|
||||
```
|
||||
|
||||
- For different OS, localhost should work.
|
||||
|
||||
4. Open ***http://docker-machine-ip-address:6080*** from web browser.
|
||||
|
||||
![][noVNC]
|
||||
|
||||
|
||||
Connect to Selenium Grid
|
||||
------------------------
|
||||
|
||||
This feature can be used only if you set **APPIUM=True** in environment variable.
|
||||
|
||||
**Arguments**
|
||||
|
||||
-e CONNECT_TO_GRID=True : to connect appium server to your selenium grid.
|
||||
-e APPIUM_HOST="<host_ip_address>": where / on which instance appium server is running. Default value: 127.0.0.1
|
||||
-e APPIUM_PORT=<port_number>: which port appium server is running. Default port: 4723
|
||||
-e SELENIUM_HOST="<host_ip_address>": where / on which instance selenium grid is running. Default value: 172.17.0.1
|
||||
-e SELENIUM_PORT=<port_number>: which port selenium grid is running. default port: 4444
|
||||
|
||||
![][connect to grid 1] ![][connect to grid 2]
|
||||
|
||||
List of Devices
|
||||
---------------
|
||||
|
||||
Type | Device Name
|
||||
--- | ---
|
||||
----- | -----
|
||||
Phone | Samsung Galaxy S6
|
||||
Phone | Nexus 4
|
||||
Phone | Nexus 5
|
||||
|
@ -107,7 +62,65 @@ Tablet | Nexus 7
|
|||
Tablet | Nexus 9
|
||||
Tablet | Nexus 10
|
||||
|
||||
![][galaxy s6] ![][nexus 5]
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Docker is installed in your system.
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
||||
1. Run docker-android
|
||||
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
2. Verify the ip address of docker host.
|
||||
|
||||
- For OSX, you can find out by using following command:
|
||||
|
||||
```bash
|
||||
docker-machine ip default
|
||||
```
|
||||
|
||||
- For different OS, localhost should work.
|
||||
|
||||
3. Open ***http://docker-machine-ip-address:6080*** from web browser.
|
||||
|
||||
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***.
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
### Connect to Selenium Grid
|
||||
|
||||
![][selenium grid]
|
||||
![][devices are connected with selenium grid]
|
||||
|
||||
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>
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
### Share Volume
|
||||
|
||||
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 <phone_number> <message>
|
||||
```
|
||||
|
||||
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]: <images/noVNC.png> "login with noVNC to see what happen inside container"
|
||||
[connect to grid 1]: <images/appium_with_selenium_grid_01.png>
|
||||
[connect to grid 2]: <images/appium_with_selenium_grid_02.png>
|
||||
[galaxy s6]: <images/run_under_galaxy_s6.png>
|
||||
[nexus 5]: <images/run_under_nexus_5.png>
|
||||
[appium]: <https://appium.io>
|
||||
[docker android samsung]: <images/docker_android_samsung.png>
|
||||
[docker android nexus]: <images/docker_android_nexus.png>
|
||||
[selenium grid]: <images/selenium_grid.png>
|
||||
[devices are connected with selenium grid]: <images/connected_with_grid.png>
|
||||
[adb_connection]: <images/adb_connection.png>
|
||||
[sms]: <images/SMS.png>
|
||||
[adblib]: <https://github.com/tananaev/adblib>
|
||||
|
|
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 66 KiB |
BIN
images/connected_with_grid.png
Normal file
After Width: | Height: | Size: 448 KiB |
BIN
images/docker_android_nexus.png
Normal file
After Width: | Height: | Size: 150 KiB |
BIN
images/docker_android_samsung.png
Normal file
After Width: | Height: | Size: 244 KiB |
BIN
images/noVNC.png
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 311 KiB |
Before Width: | Height: | Size: 240 KiB |
BIN
images/selenium_grid.png
Normal file
After Width: | Height: | Size: 76 KiB |