In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to use appium to do Android mobile phone automated testing, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Appium, an automated testing tool that sounds both unfamiliar and familiar, may be unremarkable compared to the original UiAutomator, but it has its own ability to complete a lot of difficult tasks and some tasks that can not be completed by UiAutomator. It can be said that appium enriches the functions of UiAutomator and enables UiAutomator to complete more tasks.
What are the advantages of Appium that will give us priority to choose it for automation?
1. Summarize Appium in one sentence
An automated testing framework for mobile applications that supports cross-platform applications, including Native, Hybird and Mobile Web. Its characteristics can be summarized as follows:
Cross-platform only one set of code
There is no need to set the signature and do not pollute the source code
Can be tested without the need for project source code
Multilingual support
Supports a variety of common frameworks
Completely open source, active community
Second, a preliminary understanding of the working process of appium
1.appium has Cpact S mode.
2.appium is an extension of mobile device automation api based on the webdriver protocol, all of which have the same features as webdriver, such as multilingual support.
3.webdriver is based on the http protocol. The first connection establishes a session session and sends a json to the server to inform the server of the relevant test information through post.
4. For Android, 4.2 is based on the UiAutomator framework to find injected events, while 4.2 was previously implemented in the instrumentation framework and packaged into a service called Selendroid.
5. The client only needs to send a http request to communicate, which means that the client is supported in multiple languages.
The 6.appium server is written by node.js, so to install that platform is to install node first, and then npm install-g appium (FQ is required).
Third, environmental construction
Steps:
1.java development environment JDK
2.android SDK (platform/platform tools/tools/build tools)
Download and install 3.python (pip)
4.appium download and installation (server + client)
5. Install appium-python-client
6. Install unittest
The first step
Install JDK and configure environment variables after the installation is complete.
Under cmd, java-version checks whether the environment variable is configured successfully.
Step two
To install Android SDK (Android software development kit), it is necessary to install Android SDK to test Android phones.
Download address: http://tools.android-studio.org/index.php/sdk/
After unzipping, add the folder to the environment variable, add the environment variable, you must create a variable named ANDROID_HOME.
Double-click SDK Manager to select the tool. Required: you can choose whether to update Android SDK Platform-tools and Android SDK Build-tools,Android SDK Tools under the Tools folder. It is recommended to update OK directly. GoogleFQ installation: all installations under the Extras folder.
Add the ANDROID_HOME, tools, platform-tools, build-tools directories to the Path environment variable. Save the changes.
After the environment variable is configured, connect to the Android phone and open the developer option-USB debugging for the Android phone.
Execute under CMD, adb devices, and the following image style indicates that the UDID of the Android phone connected to the computer is obtained through the adb command.
Adb devices is bound to encounter a lot of holes when it comes to getting connected Android phones. Here's a look at the holes that might be encountered.
1. USB debugging of mobile phone must be turned on.
2. Find two more USB cables to eliminate the cable problem.
3. Change a few more USB interfaces to eliminate the problems caused by individual USB interfaces (such as 3.0,2.0)
4, driver, through the device manager to see if the driver is installed or the driver is not up-to-date.
5. Update the adb_usb.ini file. When a few computers cannot recognize the Android phone, you can add the VID and PID of the Android phone under the device manager to the adb_usb.ini file.
Increase the 4 digits after "_" in VID and PID to adb_usb.ini (Note: adb_usb.ini is in the .Android directory under the current user's home directory on disk C by default)
In theory, after all these operations have been done, the basic adb devices can find the Android phone.
Step three
Install node.js, and then you can install Appium directly through npm. (note: npm is similar to Python's pip, an unofficial package manager)
Official download address: https://nodejs.org/en/download/
Download different versions of node.js according to your operating system
Node.js installation all the way silly next will be fine, after the successful installation will automatically add environment variables.
After the installation is successful, check to see if npm is available.
The fourth step
Install the appium server, which can be installed by typing npm install-g appium under cmd.
If npm install-g appium is too slow to download, you can use the domestic image npm-- registry http://registry.cnpmjs.org install-g appium.
If the installation fails, you can try to install appium through cnpm
Install cnpm through the npm command
Npm install-g cnpm-- registry= https://registry.npm.taobao.org
Install appium through cnpm
Cnpm install-g appium-- no-cache
After the installation is successful, check the current appium version through appium-v, and enter appium directly to start the appium server side.
If you still cannot download the appium server, you can only download the corresponding Appium version of the operating system from the official Appium website.
Https://bitbucket.org/appium/appium.app/downloads/
The latest version is AppiumForWindows_1_4_16_1.zip. Note that this is a Windows version. If your computer is MAC, please download appium-1.5.3.dmg.
Then provide a download link for Baidu network disk: https://pan.baidu.com/s/1Y4pD3fjjeKJNv_6E7seQBQ
Let's take Windows as an example, decompress the downloaded AppiumForWindows.zip and click appium-installer.exe to install it.
Double-click to start, and the appium server interface is as follows.
Finally, open the Windows command prompt and enter the "appium-doctor" command. If the following prompt appears, it means that all the environments you need for Appium are ready.
Note: if prompted: "appium-doctor" is not an internal or external command, locate the directory where Appium is installed, for example:
C:\ Program Files\ Appium\ node_modules\ .bin
Add to the environment variable path.
Step five
Install the appium client to grab the location information on the app.
Double-click the installation, and after the installation is successful, there will be a shortcut to appium on the left.
At this point, all the environments for Windows-Android-appium have been built.
At present, Appium is a relatively advanced testing tool, which can cover all aspects involved in UiAutomator and complete automatic testing of webview, but the deployment environment is complex, and many abnormal situations are difficult to locate the problem. At the same time, there is a lack of online data, so its popularity is not very wide. I hope this article can help students who need to use appium tools to quickly cross the level of building the environment. Quickly put into the automated testing of hybrid App.
On how to use appium to do Android mobile phone automation testing is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.