使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
测试应用是应用开发过程中不可或缺的一部分。通过持续对应用运行测试,您可以在公开发布应用之前验证其正确性、功能行为和易用性。
测试还具有以下优势:
- 快速获得故障反馈。
- 在开发周期中尽早进行故障检测。
- 更安全的代码重构,让您可以优化代码而不必担心回归。
- 稳定的开发速度,帮助您最大限度地减轻技术负担。
文档
本文档介绍了有关测试 Android 应用的最佳实践:
其他资源
如需详细了解如何在 Android 平台上进行测试,请参阅以下资源。
示例
Codelab
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Test apps on Android\nPart of [Android Jetpack](/jetpack).\n=========================================================\n\nTesting your app is an integral part of the app development process. By running\ntests against your app consistently, you can verify your app's correctness,\nfunctional behavior, and usability before you release it publicly.\n\nTesting also offers the following advantages:\n\n- **Rapid feedback** on failures.\n- **Early failure detection** in the development cycle.\n- **Safer code refactoring**, allowing you to optimize code without worrying about regressions.\n- **Stable development velocity**, helping you minimize technical debt.\n\nDocumentation\n-------------\n\nThe documentation covers best practices around testing Android apps:\n\n- [Fundamentals of testing Android apps](/training/testing/fundamentals)\n- [Build local unit tests](/training/testing/local-tests) that run on the host\n- [Build instrumented tests](/training/testing/instrumented-tests) that run on devices or emulators\n- Verify UIs with [Behavior](/training/testing/ui-tests/behavior) and [Screenshot tests](/training/testing/ui-tests/screenshot)\n- [Test different screen sizes](/training/testing/different-screens)\n\nAdditional resources\n--------------------\n\nFor more information about testing on Android, consult the following resources.\n\n### Samples\n\n- [Android testing samples](https://github.com/android/testing-samples)\n- [Now In Android demo app](https://github.com/android/nowinandroid), which makes use of the Android testing libraries.\n\n### Codelabs\n\n- [Android Testing Codelab](/codelabs/advanced-android-kotlin-training-testing-basics)\n\nMedia\n-----"]]