One article understands how to use common mobile (Android) automated testing tools - Appium

automated test

Everyone knows about automated testing. In the past ten years, the skill of automated testing has always been a skill that software testing practitioners want to master. According to relevant surveys, about 70% of people who want to master automated testing skills have become

This article will bring the content of automated testing for mobile (Android) in automated testing and a brief overview of its testing framework, hoping to give you a general understanding of Android automated testing, and then take Appium as an example to introduce its environment Build and basic use.


Android automated testing

Android automation test brief introduction Automated test content Android can be automated through the automation framework or cloud test platform, and the test content includes the following aspects:

  • Compatibility testing: installation, startup, uninstallation
  • Functional testing: gesture operation, functional verification
  • Stability test: whether the app is prone to crashes and other phenomena
  • Scenario test: Simulate real network scenarios, switch between 2G, 3G, 4G, and wifi networks

automated testing framework

Espresso Espresso is an Android automated testing framework open sourced by Google for the Android platform. It is mainly used for automated testing of Android App UI. It uses Java to write test code, supported by Glide and Android Studio, and the test runs quite fast.

UI Automator is also a simple UI automation testing tool officially released by Google. It can be tested across APPs. It must be used with Android 4.0 or above. If you want to use resource id to locate controls when positioning, you must use API18 or above. uiautomatorviewer is a tool that comes with the android SDK. Provide users with control information viewing services by taking screenshots and analyzing XML layout files. The tool is located in the tools\bin subdirectory under the SDK directory

Appium Appium is an open source, cross-platform testing framework that can be used to test Native Apps, hybrid applications, mobile web applications (H5 applications), etc. Appium: is the core of the Appium system, because it is also a web interface service, so it also It will be called appium server, and multiple ports including 4723 are opened by default. Appium-Desktop: In order to make Appium more usable, make it easier for Xiaobai to get started, and make debugging and interface analysis more convenient, the official GUI tool Appium-desktop has been developed. Appium Client: Appium is just a web interface. It accepts HTTP requests, so each language can encapsulate and send requests by itself, so there are various sub-projects under appium

Among the above three frameworks, Appium is the most common. Especially in recent years, Appium’s market share has ranged from 25% to 42% in 2019. Without major technological breakthroughs, Appium will have a bigger future market share, it will become more urgent to learn the tool of Appium

Next, I will teach you how to install and use Appium, a tool

Appium installation and use

Apppium installation and configuration (Mac version) Basic environment construction


1 Install java environment , git, ruby, brew, Android SDK environment

// Check whether the above environment is installed

java -version
git --version
ruby -v
brew -v
adb


2 Configure related environment variables Install Appium and related packages (Java version)

1 Appium Download

2 java-client and selenium package download Select the corresponding Java Client, and download the dependent selenium package from the Compile Dependencies at the bottom of its details page. When writing java automated test scripts, download packages in Compile Dependencies as needed, such as commons-lang3.

Basic use of Apppium

adb command

  • Use tcpip to connect to the mobile phone (the computer and the mobile phone need to be in the same LAN)
// 先usb连接手机,设置手机tcp连接端口为5555
adb tcpip 5555
// 断开usb,采用tcpip连接手机
adb connect 10.33.70.165:5555
// 断开tcpip连接
adb disconnect 10.33.70.165:5555

Get App Information

 // 获取当前界面元素
adb shell dumpsys activity top
// 获取App入口
adb shell dumpsys activity activities
// 启动app
adb shell am start -W -n com.xueqiu.android/.view.WelcomeActivityAlias -S
// 获取当前界面元素 adb shell dumpsys activity top
 
 
  • Operate the phone (type, key, tap, swipe)

adb shell text/keyevent/tapswipe/press/roll

epilogue

The above content is the entire content of this article. I hope the above content is helpful to you. Friends who have been helped are welcome to like and comment.

The following are supporting learning materials. For friends who do [software testing], it should be the most comprehensive and complete preparation warehouse. This warehouse also accompanied me through the most difficult journey. I hope it can help you too!

Software testing interview applet

The software test question bank maxed out by millions of people! ! ! Who is who knows! ! ! The most comprehensive quiz mini program on the whole network, you can use your mobile phone to do the quizzes, on the subway or on the bus, roll it up!

The following interview question sections are covered:

1. Basic theory of software testing, 2. web, app, interface function testing, 3. network, 4. database, 5. linux

6. web, app, interface automation, 7. performance testing, 8. programming basics, 9. hr interview questions, 10. open test questions, 11. security testing, 12. computer basics

Information acquisition method:

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/132240367