Directory
First, Appium environment construction
1. Download the Nodejs and install
2. Download the Appium and install
3. Install Python, install pip, install Appium
4. Installing the Java JDK
5. Install the Andriod SDK and add the Android_home Configuration SDK Directory
II. Environment preparation for scripting in the Eclipse Editor in Python language
1. Install the Python plugin
2. Select the python execution file at runtime and the Python package required
Three, automated testing program (from the construction, case preparation, case organization, report output)
1. Create a new project, create a new Automation script file for the py file, or import an existing project file for scripting.
2. Using the Appium framework, initialize
3.Case Code (example of a module)
4. Automated Test Results Report
5. Case integration for all modules
First, Appium environment construction 1. Download Nodejs, and install
Nodejs:
https://nodejs.org/en/download/
Note: Download the Nodejs that matches the current operating system
2. Download the Appium and install
Method 1:NPM Install-g Appium
Method 2:npm-g--registry http://registry.cnpmjs.org Install Appium
Note: Method 1 prompts for an error, use Method 2, Method 2 Download the resource is slow, need to wait, or the next time in the run
3. Install Python, install pip, install Appium
A) Install Python
Python:
https://www.python.org/downloads/
b) Install Pip
Related address: https://pip.pypa.io/en/stable/installing/
Operation Method:
To determine if the PIP installation was successful:
c) Install Appium
Pip Install Appium-python-client
Pip Install Selenium
Note: Python and Pip need to be added to the environment variable (PIP is installed in the Python/script path)
4. Installing the Java JDK
To see if the installation was successful after the installation is complete by java-version
5. Install the Andriod SDK and add the Android_home Configuration SDK Directory
Appium Environment was built.
II. Environment preparation for scripting in the Eclipse Editor in Python language
Scripts can be written in a variety of languages using Appium, using Python, which is the editor used by Eclipse.
To write a Python script in the Eclipse Editor, you need to install the Python plugin:
1. Install the Python plugin
A) Click Help→install New Software
b) Enter Pydev in work with, click on the Red box content
c) Tick all items and click Next (as this is already installed, the next step is to place the ash)
d) Pop-up the following prompt box, Select all, click OK
e) Wait for the installation, the eclipse in the bottom of the display will show a small green progress, it must wait until the completion of the progress, the popup whether to restart Eclipse, and then shut down eclipse, or plug-ins are not installed on the way.
2. Select the python execution file at runtime and the Python package required
Click on the window's preferences pop-up windows, the installation figure in the corresponding operation, will be Python executable files and Python needs to join the package, click Apply, then click OK
Three, automated testing program (from the construction, case preparation, case organization, report output)
1. Create a new project, create a new Automation script file for the py file, or import an existing project file for scripting.
? Create a new project:
A Click File→new→pydev Project (if you don't have PyDev project, click Other and follow the popup box to build
B To create a folder and a Python file, right-click on the created project name and select the type you want to create
Attached (the imported project file): You can create the required files and folders in the same way
The contents of the Red Arrows are case files (we created the case file according to the module)
Note:
- If you need to define a folder as a package, you need to create an empty _init_.py file under that folder, and the other py files are the automation scripts that you need.
- The _int_.py:python package must contain the file. It will be a package, or it is a folder, folder to become a package, you need to build a package
- basecase.py: Is the file that you define, the initialization information that the program needs to use, and the public function information is placed in the file
- all_tests.py: is to add all the case to be executed to the file, test report results of the code written to the file, directly execute the file, you can get the project needs automated test results
- garbage_cleanup_19.py: is an Automation case for a module of the assistant project
2. Using the Appium framework, initialize
Put the following code into a py file, in the Automation case script to reference the file, so that the replacement of the device is easy to modify, the current project is written to the basecase.py file
Note: initialization information and other parameters, such as: Unicodekeyboard, Resetkeyboard and so on, we need to define what parameters are here to do the definition can
3. Case code (example of a module)
Test_19_1 is the specific procedure and the result to be checked, that is, the specific case script
4. Automated Test Results Report
A Store files in the Python lib directory
http://file.mt.sogou.com/g2/M00/08/AB/CoZa6FbGyhyAfYwuAABfsU3Pcek5228.py?n=HTMLTestRunner.py
B Place the following code at the end of the all_tests.py file, or at the end of a case in a module
Note:
After the case executes, the following file appears, right-click on the file and open the file to Web browser to see the test results.
After the case is executed:
Test results:
5. Case integration for all modules
Android Automation (Appium)