# 基础

## Appium简介

> Appium 是一个开源项目和相关软件的生态系统。 软件，旨在促进许多应用程序平台的用户界面自动化，包括移动平台（iOS、 Android、Tizen）、浏览器（Chrome、Firefox、Safari）、桌面（macOS、Windows）、电视（Roku、tvOS、 Android TV、三星）等！

上面是[Appium官网](https://appium.io/docs/en/latest/)对于该项目的介绍。更加常见的看法是，Appium是移动端（Android和iOS）的UI自动化测试框架。因为浏览器和桌面等平台，UI测试自动化框架很多，其中一些优秀的框架成熟度和市场占有率比较高，大部分公司不会选择Appium作为这些平台的UI自动化实现方式。而对于Android和iOS两个平台，Appium可谓是当仁不让的王者地位。

Android端官方的UI测试框架是[Espresso](https://developer.android.com/training/testing/espresso)，iOS端官方的UI测试框架是[XCUITest](https://developer.apple.com/documentation/xctest/user_interface_tests)。Appium相对这两套native的解决方案，有以下几个优点：

1. 一套代码，两个平台。目前市场上，大部分UI自动化是由测试人员写的，而一个测试人员通常需要负责Android和iOS两个平台，使用一套代码，统一的API，解决两个平台，能大大提高测试的工作效率。
2. 多编程语言支持。Appium不限定编程语言，可以使用所有常用的语言进行开发，而Espresso限定Java/Kotlin，XCUITest限定Swift。
3. 黑盒测试。降低自动化测试的门槛，不需要熟悉App的代码。

相对的缺点有：

1. 性能不如native的解决方案，测试用例执行时间较长。
2. 稳定性不如native的解决方案，部分测试用例存在失败的概率。
3. 黑盒测试，便利性不如native的解决方案，需要模拟用户的步骤执行测试用例，用例步骤较长。

总之，如果是测试人员负责UI自动化的工作，Appium是较好的解决方案；但是如果是Android开发和iOS开发人员各自负责自己平台的自动化测试工作，显然Espresso和XCUITest是更好的选择。

## Appium的安装


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://appium.tinks.app/ji-chu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
