From 5b991926433a8d1d91d4b01efcc3ea9f602e18e3 Mon Sep 17 00:00:00 2001 From: SurajKumarM98 <41251272+SurajKumarM98@users.noreply.github.com> Date: Sat, 12 Oct 2019 14:46:41 +0530 Subject: [PATCH 1/2] Update README.md --- README.md | 243 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 164 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index f36df11df..31e2cfdca 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,202 @@ +Skip to content + +Pull requestsIssues +Marketplace +Explore + + + +Learn Git and GitHub without any code! +Using the Hello World guide, you’ll start a branch, write comments, and open a pull request. +Read the guide + + Used by +33 + Watch +185 + Star3.1k + Fork +474 +AirtestProject/Airtest + Code Issues 131 Pull requests 0 Projects 0 Wiki Security Insights +You’re editing a file in a project you don’t have write access to. We’ve created a fork of this project for you to commit your proposed changes to. Submitting a change to this file will write it to a new branch in your fork, so you can send a pull request. +Airtest/Cancel + Edit file Preview changes + + +Spaces + +Tabs + + + +2 + +4 + +8 + + + +No wrap + +Soft wrap + + + + + +1 # Airtest · [![Build status](https://travis-ci.org/AirtestProject/Airtest.svg?branch=master)](https://travis-ci.org/AirtestProject/Airtest) - +2 +​ +3 **Cross-Platform UI Automation Framework for Games and Apps** - +4 +​ +5 **跨平台的UI自动化框架,适用于游戏和App** ([中文版点这里](./README_zh.md)) - - +6 +​ +7 +​ +8 ![image](./demo.gif) - - +9 +​ +10 +​ +11 ## Features - -* **Write Once, Run Anywhere:** Airtest provides cross-platform APIs, including app installation, simulated input, assertion and so forth. Airtest uses image recognition technology to locate UI elements, so that you can automate games and apps without injecting any code. - -* **Fully Scalable:** Airtest cases can be easily run on large device farms, using commandline or python API. HTML reports with detailed info and screen recording allow you to quickly locate failure points. NetEase builds [Airlab](https://airlab.163.com/) on top of Airtest Project. - +12 +​ +13 +* **Write Once, Run Anywhere:** Airtest provides cross-platform APIs, including app installation, simulated input, assertion and so forth. Airtest uses image recognition technology to locate UI elements so that you can automate games and apps without injecting any code. +14 +​ +15 +* **Fully Scalable:** Airtest cases can be easily run on large device farms, using command-line or python API. HTML reports with detailed info and screen recording allow you to quickly locate failure points. NetEase builds [Airlab](https://airlab.163.com/) on top of Airtest Project. +16 +​ +17 * **AirtestIDE:** AirtestIDE is an out of the box GUI tool that helps to create and run cases in a user-friendly way. AirtestIDE supports a complete automation workflow: ``create -> run -> report``. - +18 +​ +19 * **Poco:** [Poco](https://github.com/AirtestProject/Poco) adds the ability to directly access object(UI widget) hierarchy across the major platforms and game engines. it allows writing instructions in Python, to achieve more advanced automation. - +20 +​ +21 Get started from [airtest homepage](http://airtest.netease.com/) - +22 +​ +23 #### [Supported Platforms](./docs/wiki/platforms.md) - +24 +​ +25 | | | | | | | | | +26 |-|-|-|-|-|-|-|-| +27 [Android](http://airtest.netease.com/docs/en/1_quick_start/2_test_with_Android_device.html) |[Emulator](./docs/wiki/platforms.md#android-emulator) |[iOS](https://github.com/AirtestProject/iOS-Tagent)|[Windows](http://airtest.netease.com/docs/en/1_quick_start/4_get_started_with_Windows_test.html)|[Unity](http://airtest.netease.com/docs/en/1_quick_start/1_how_to_write_the_first_script_for_your_game.html)|Cocos2dx|Egret|[WeChat](http://airtest.netease.com/blog/tutorial/WechatSmallProgram/)| [web](http://airtest.netease.com/docs/en/1_quick_start/5_get_started_with_web_test.html) - +28 +​ +29 ## Installation - +30 +​ +31 Use `pip` to install Airtest python library. - +32 +​ +33 ```Shell +34 pip install -U airtest +35 ``` - +36 +​ +37 On MacOS/Linux platform, you need to grant adb execute permission. - +38 +​ +39 ```Shell +40 # for mac +41 cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac -# for linux +42 +# for Linux +43 # cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux +44 chmod +x adb +45 ``` - +46 +​ +47 Download AirtestIDE from our [homepage](http://airtest.netease.com/) if you need to use the GUI tool. - - +48 +​ +49 +​ +50 ## Documentation - +51 +​ +52 You can find the complete Airtest documentation on [readthedocs](http://airtest.readthedocs.io/). - - +53 +​ +54 +​ +55 ## Examples - -Airtest aims at providing platform independent API, so that you can write automated cases once and run it on multiple devices and platforms. - +56 +​ +57 +Airtest aims at providing platform-independent API so that you can write automated cases once and run it on multiple devices and platforms. +58 +​ +59 1. Using [connect_device](http://airtest.readthedocs.io/en/latest/README_MORE.html#connect-device) API you can connect to any android/iOS device or windows application. +60 1. Then perform [simulated input](http://airtest.readthedocs.io/en/latest/README_MORE.html#simulate-input) to automate your game or app. +61 1. **DO NOT** forget to [make assertions](http://airtest.readthedocs.io/en/latest/README_MORE.html#make-assertion) of the expected result. - +62 +​ +63 ```Python +64 from airtest.core.api import * - +65 +​ +66 # connect an android phone with adb +67 init_device("Android") +68 # or use connect_device api -# connect_device("Android:///") - -install("path/to/your/apk") -start_app("package_name_of_your_apk") -touch(Template("image_of_a_button.png")) -swipe(Template("slide_start.png"), Template("slide_end.png")) -assert_exists(Template("success.png")) -keyevent("BACK") -home() -uninstall("package_name_of_your_apk") -``` - -For more detailed info, please refer to [Airtest Python API reference](http://airtest.readthedocs.io/en/latest/all_module/airtest.core.api.html) or take a look at [API code](./airtest/core/api.py) - - -## Running ``.air`` cases from CLI - -Using AirtestIDE, you can easily create automated cases as ``.air`` directories. -Airtest CLI provides the possibility to execute cases on different host machine and target device platforms without using AirtestIDE itself. - -```Shell -# run cases targeting on Android phone connected to your host machine via ADB -airtest run "path to your .air dir" --device Android:/// - -# run cases targeting on Windows application whose title matches Unity.* -airtest run "path to your .air dir" --device "Windows:///?title_re=Unity.*" - -# generate HTML report after running cases -airtest report "path to your .air dir" - -# or use as python module -python -m airtest run "path to your .air dir" --device Android:/// -``` - -Try running provided example case: [``airtest/playground/test_blackjack.air``](./playground/test_blackjack.air) and see [Usage of CLI](http://airtest.readthedocs.io/en/latest/README_MORE.html#running-air-from-cli). Here is a [multi-device runner sample](https://github.com/AirtestProject/multi-device-runner). - - -## Contribution - -Pull requests are very welcome. [Help needed here](./docs/wiki/platforms.md#pull-request-guide) - - -## Thanks -Thanks for all these great works that make this project better. +Propose file change +Commit summaryOptional extended description + +Propose file change Cancel +© 2019 GitHub, Inc. +Terms +Privacy +Security +Status +Help +Contact GitHub +Pricing +API +Training +Blog +About -- [stf](https://github.com/openstf) -- [atx](https://github.com/NetEaseGame/ATX) -- [pywinauto](https://github.com/pywinauto/pywinauto) From 0fb559d97438c8c530cc8222da1e9c3f95eeb121 Mon Sep 17 00:00:00 2001 From: SurajKumarM98 <41251272+SurajKumarM98@users.noreply.github.com> Date: Wed, 16 Oct 2019 20:13:48 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 245 ++++++++++++++++++------------------------------------ 1 file changed, 80 insertions(+), 165 deletions(-) diff --git a/README.md b/README.md index 31e2cfdca..75f203c3b 100644 --- a/README.md +++ b/README.md @@ -1,202 +1,117 @@ -Skip to content - -Pull requestsIssues -Marketplace -Explore - - - -Learn Git and GitHub without any code! -Using the Hello World guide, you’ll start a branch, write comments, and open a pull request. -Read the guide - - Used by -33 - Watch -185 - Star3.1k - Fork -474 -AirtestProject/Airtest - Code Issues 131 Pull requests 0 Projects 0 Wiki Security Insights -You’re editing a file in a project you don’t have write access to. We’ve created a fork of this project for you to commit your proposed changes to. Submitting a change to this file will write it to a new branch in your fork, so you can send a pull request. -Airtest/Cancel - Edit file Preview changes - - -Spaces - -Tabs - - - -2 - -4 - -8 - - - -No wrap - -Soft wrap - - - - - -1 # Airtest · [![Build status](https://travis-ci.org/AirtestProject/Airtest.svg?branch=master)](https://travis-ci.org/AirtestProject/Airtest) -2 -​ -3 + **Cross-Platform UI Automation Framework for Games and Apps** -4 -​ -5 + **跨平台的UI自动化框架,适用于游戏和App** ([中文版点这里](./README_zh.md)) -6 -​ -7 -​ -8 + + ![image](./demo.gif) -9 -​ -10 -​ -11 + + ## Features -12 -​ -13 + * **Write Once, Run Anywhere:** Airtest provides cross-platform APIs, including app installation, simulated input, assertion and so forth. Airtest uses image recognition technology to locate UI elements so that you can automate games and apps without injecting any code. -14 -​ -15 -* **Fully Scalable:** Airtest cases can be easily run on large device farms, using command-line or python API. HTML reports with detailed info and screen recording allow you to quickly locate failure points. NetEase builds [Airlab](https://airlab.163.com/) on top of Airtest Project. -16 -​ -17 + +* **Fully Scalable:** Airtest cases can be easily run on large device farms, using commandline or python API. HTML reports with detailed info and screen recording allow you to quickly locate failure points. NetEase builds [Airlab](https://airlab.163.com/) on top of the Airtest Project. + * **AirtestIDE:** AirtestIDE is an out of the box GUI tool that helps to create and run cases in a user-friendly way. AirtestIDE supports a complete automation workflow: ``create -> run -> report``. -18 -​ -19 -* **Poco:** [Poco](https://github.com/AirtestProject/Poco) adds the ability to directly access object(UI widget) hierarchy across the major platforms and game engines. it allows writing instructions in Python, to achieve more advanced automation. -20 -​ -21 + +* **Poco:** [Poco](https://github.com/AirtestProject/Poco) adds the ability to directly access object(UI widget) hierarchy across the major platforms and game engines. It allows writing instructions in Python, to achieve more advanced automation. + Get started from [airtest homepage](http://airtest.netease.com/) -22 -​ -23 + #### [Supported Platforms](./docs/wiki/platforms.md) -24 -​ -25 + | | | | | | | | | -26 |-|-|-|-|-|-|-|-| -27 [Android](http://airtest.netease.com/docs/en/1_quick_start/2_test_with_Android_device.html) |[Emulator](./docs/wiki/platforms.md#android-emulator) |[iOS](https://github.com/AirtestProject/iOS-Tagent)|[Windows](http://airtest.netease.com/docs/en/1_quick_start/4_get_started_with_Windows_test.html)|[Unity](http://airtest.netease.com/docs/en/1_quick_start/1_how_to_write_the_first_script_for_your_game.html)|Cocos2dx|Egret|[WeChat](http://airtest.netease.com/blog/tutorial/WechatSmallProgram/)| [web](http://airtest.netease.com/docs/en/1_quick_start/5_get_started_with_web_test.html) -28 -​ -29 + ## Installation -30 -​ -31 -Use `pip` to install Airtest python library. -32 -​ -33 + +Use `pip` to install the Airtest python library. + ```Shell -34 pip install -U airtest -35 ``` -36 -​ -37 -On MacOS/Linux platform, you need to grant adb execute permission. -38 -​ -39 + +On the macOS/Linux platform, you need to grant adb execute permission. + ```Shell -40 # for mac -41 cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac -42 -# for Linux -43 +# for linux # cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux -44 chmod +x adb -45 ``` -46 -​ -47 + Download AirtestIDE from our [homepage](http://airtest.netease.com/) if you need to use the GUI tool. -48 -​ -49 -​ -50 + + ## Documentation -51 -​ -52 + You can find the complete Airtest documentation on [readthedocs](http://airtest.readthedocs.io/). -53 -​ -54 -​ -55 + + ## Examples -56 -​ -57 + Airtest aims at providing platform-independent API so that you can write automated cases once and run it on multiple devices and platforms. -58 -​ -59 + 1. Using [connect_device](http://airtest.readthedocs.io/en/latest/README_MORE.html#connect-device) API you can connect to any android/iOS device or windows application. -60 1. Then perform [simulated input](http://airtest.readthedocs.io/en/latest/README_MORE.html#simulate-input) to automate your game or app. -61 1. **DO NOT** forget to [make assertions](http://airtest.readthedocs.io/en/latest/README_MORE.html#make-assertion) of the expected result. -62 -​ -63 + ```Python -64 from airtest.core.api import * -65 -​ -66 + # connect an android phone with adb -67 init_device("Android") -68 # or use connect_device api +# connect_device("Android:///") + +install("path/to/your/apk") +start_app("package_name_of_your_apk") +touch(Template("image_of_a_button.png")) +swipe(Template("slide_start.png"), Template("slide_end.png")) +assert_exists(Template("success.png")) +keyevent("BACK") +home() +uninstall("package_name_of_your_apk") +``` + +For more detailed info, please refer to [Airtest Python API reference](http://airtest.readthedocs.io/en/latest/all_module/airtest.core.api.html) or take a look at [API code](./airtest/core/api.py) + + +## Running ``.air`` cases from CLI + +Using AirtestIDE, you can easily create automated cases as ``.air`` directories. +Airtest CLI provides the possibility to execute cases on different host machines and target device platforms without using AirtestIDE itself. + +```Shell +# run cases targeting on Android phone connected to your host machine via ADB +airtest run "path to your .air dir" --device Android:/// + +# run cases targeting on Windows application whose title matches Unity.* +airtest run "path to your .air dir" --device "Windows:///?title_re=Unity.*" + +# generate HTML report after running cases +airtest report "path to your .air dir" + +# or use as a python module +python -m airtest run "path to your .air dir" --device Android:/// +``` + +Try running provided example case: [``airtest/playground/test_blackjack.air``](./playground/test_blackjack.air) and see [Usage of CLI](http://airtest.readthedocs.io/en/latest/README_MORE.html#running-air-from-cli). Here is a [multi-device runner sample](https://github.com/AirtestProject/multi-device-runner). + + +## Contribution + +Pull requests are very welcome. [Help needed here](./docs/wiki/platforms.md#pull-request-guide) + + +## Thanks -Propose file change -Commit summaryOptional extended description - -Propose file change Cancel -© 2019 GitHub, Inc. -Terms -Privacy -Security -Status -Help -Contact GitHub -Pricing -API -Training -Blog -About +Thanks for all these great works that make this project better. +- [stf](https://github.com/openstf) +- [atx](https://github.com/NetEaseGame/ATX) +- [pywinauto](https://github.com/pywinauto/pywinauto)