This is the 14th day of my participation in the Challenge. For details, see:More article challenges

1. Appium tools

1.1 the principle

Appium is mainly divided into Client and Server,

Client Server
Encapsulates the Selenium client class library to provide users with all the common Selenium commands as well as additional commands related to mobile device control, such as multi-touch gestures and screen orientation; An extension that defines the official protocol and provides a convenient interface for users to perform various device actions, such as installing/uninstalling the App during testing.

The Client sends HTTP requests to the Server. When receiving the requests, the Server parses the request content and invokes the corresponding system framework to perform automatic operations on the mobile device. Since HTTP is used between the Client and Server, the Client can develop the automation program in any language.

1.2 Basic APIS of Appium

1.2.1 Starting Another App Using a Script

Driver.start_activity (” package name “,” interface name “) —– Package name and interface name of other apps

Jump from bilibili ------ to -----QQ
driver.start_activity("com.tencent.mobileqq".".activity.RegisterGuideActivity")
Copy the code

1.2.2 Obtaining the package name and interface name of the APP

1.2.3 Closing the APP and driver

Difference: quit is equivalent to clearing the driver object, so there is no. Current_package method, while close_app does not clear the driver object

1.2.3 Installation and Uninstallation, and whether to install the APP

The core code

` `

# Determine whether QQ already exists
if driver.is_app_installed("com.tencent.mobileqq") :Uninstall it if it exists
    driver.remove_app("com.tencent.mobileqq")
    print("Uninstallation succeeded")
else:
    If not, install
    driver.install_app(R "C:\Users\Administrator\Desktop\ third next job \ software test \qqapk_downcc.apk")
    print("Installation successful")
Copy the code

1.2.4 Placing applications in the background

2. The adb tool

2.1 introduction

ADB(Android Debug Bridge) is a tool for managing the state of an Android terminal (or emulator). It can perform various functions, such as tracking system logs, uploading and downloading files, and installing and uninstalling applications.

The principle diagram of the 2.2

2.3 Basic Commands

1. Install the APK on the computer to the emulator

Adb install apk path

2. Obtain the package name and interface name

The adb shell dumpsys Windows Windows | findstr searches mFocusedApp (using the change command is open for a certain application)

3. Send the file to your mobile phone

Adb push computer path Folder path of the phone

4. Send files from your phone to your computer

Adb pull phone folder path computer path

5. Obtain the app startup time

Application scenarios :(1) the enterprise has requirements on the startup speed of applications. (2) With reference to similar software, the startup time cannot be more than twice)

Adb shell am start -w (uppercase) Package name/startup name

6. Get mobile log

(Application scenario: Send the bug log information to developers to help them locate bugs)

adb logcat

7. Other commands

2.4 Related Operations Screenshot