自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
Mobly 测试框架
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Mobly 是一个开源测试框架,用于由主机驱动的端到端自动化测试。您可以使用 Mobly 在多个设备上编排操作,以验证 Android 功能(包括 Wi-Fi 和电话功能)。
Mobly 基础知识
使用 Mobly,您可以编写和执行 Mobly 测试来验证 Android 功能。如需了解关于使用 Mobly 的基础知识,请参阅 Mobly 教程。
您还可以使用 Mobly Snippet Lib构建自定义测试 APK,以从主机触发设备端代码。
Mobly 功能
Mobly 测试框架提供以下功能:
Mobly 测试示例
以下是针对 Android 功能的 Mobly 测试示例:
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-04-04。
[null,null,["最后更新时间 (UTC):2025-04-04。"],[],[],null,["# Mobly test framework\n\n[Mobly](https://github.com/google/mobly/) is an open-source test framework for\nhost-driven, end-to-end automated testing. You can use Mobly to orchestrate\nactions across multiple devices to validate Android features including Wi-Fi and\ntelephony.\n\nMobly basics\n------------\n\nUsing Mobly, you can write and execute Mobly tests to verify Android features.\nTo learn the basics of using Mobly, see the\n[Mobly tutorial](https://github.com/google/mobly/blob/master/docs/tutorial.md).\n\nYou can also use the\n[Mobly Snippet Lib](https://github.com/google/mobly-snippet-lib)\nto build custom test APKs for triggering device-side code from the host.\n\nMobly features\n--------------\n\nThe Mobly test framework provides the following features:\n\n- Flexible test organization\n\n - Mobly is a standalone library, on which users can build different test\n suites. Mobly users are isolated from other users' changes.\n\n - Users can add dependencies to project-specific test suites without\n impacting other users.\n\n - Mobly snippets lets users create custom test APKs with only the APIs\n relevant to the test. This minimizes the file size overhead of test\n APKs.\n\n- Simple to maintain and debug\n\n - Mobly provides informative test results including test and snippet\n stacktraces, and per-test-iteration results for repeated or retried\n tests.\n\n - The Mobly codebase is covered by presubmit unit tests, and enforces unit\n test coverage for new code contributions, which reduces the risk of code\n errors.\n\n- Mobly snippet APKs can run without privileged access, which allows testing\n on a large number of platforms.\n\nExample Mobly tests\n-------------------\n\nThe following are examples of Mobly tests for Android features:\n\n- Test for [Wi-Fi Direct](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Wifi/tests/hostsidetests/multidevices/test/direct/wifi_direct_test.py)\n- Test for [CompanionDeviceManager](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/tests/CompanionDeviceMultiDeviceTests/host/cdm_transport_test.py)"]]