| <html devsite><head> |
| |
| <meta name="book_path" value="/_book.yaml"/> |
| |
| <meta name="project_path" value="/_project.yaml"/> |
| </head> |
| <body> |
| <!-- |
| Copyright 2018 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <h1 id="test_development_workflow" class="page-title">测试开发工作流</h1> |
| |
| <p>要将测试集成到平台连续测试服务,它们应该符合本页面中的准则并遵循以下建议流程。</p> |
| |
| <ol> |
| <li>使用 <a href="https://android.googlesource.com/platform/build/soong/">Soong 编译系统</a>以实现<a href="/compatibility/tests/development/blueprints">简单的测试配置</a>。</li> |
| <li>使用 <a href="/compatibility/tests/development/test-mapping">Test Mapping</a> 直接在 Android 源代码树中轻松创建提交前和提交后测试规则。</li> |
| <li>使用 <a href="/compatibility/tests/development/atest">Atest</a> 在本地运行测试。</li> |
| </ol> |
| |
| <h2 id="test_types">测试类型</h2> |
| |
| <p>支持的测试类型包括:</p> |
| |
| <ul> |
| <li><a href="/compatibility/tests/development/instrumentation">插桩测试</a>,这种测试支持功能测试和指标测试。要获取常规应用测试指导,请参阅<a href="https://developer.android.com/studio/test/" class="external">测试您的应用</a>。</li> |
| <li><a href="/compatibility/tests/development/native">原生测试</a>,这种测试支持以下类型:<ul> |
| <li>使用 <a href="/compatibility/tests/development/native-func-e2e">gtest</a> 框架进行的<a href="https://github.com/google/googletest" class="external">原生功能测试</a></li> |
| <li><a href="/compatibility/tests/development/metrics.md">原生指标测试</a>,这是使用 <a href="https://github.com/google/benchmark" class="external">google-benchmark</a> 进行的原生基准测试 </li> |
| </ul></li> |
| <li>使用 JUnit 进行的 <a href="/compatibility/tests/development/jar">JAR 主机测试</a></li> |
| </ul> |
| |
| <p>功能测试对测试用例进行通过或未通过测试的断言,而指标测试通常重复执行操作以收集时间指标。</p> |
| |
| <p>采用标准化的输入/输出格式后,不再需要对每个测试进行自定义结果解析和后处理,并且通用自动化测试框架可用于符合惯例的所有测试。如需了解 Android 附带的连续测试框架,请参阅 <a href="/devices/tech/test_infra/tradefed">Trade Federation 概览</a>。</p> |
| |
| <h2 id="test_case_guidelines">测试用例准则</h2> |
| |
| <p>通过连续测试服务执行的测试用例应该是<strong>封闭</strong>测试,也就是说,所有依赖项均已声明并与测试一起提供。如需了解此原则,请参阅 <a href="https://testing.googleblog.com/2012/10/hermetic-servers.html" class="external">Google Testing Blog 网站上的“Hermetic Servers”一文</a>。简而言之,封闭测试<strong>无</strong>需:</p> |
| |
| <ul> |
| <li>使用 Google 帐号登录</li> |
| <li>配置连接(电话/Wi-Fi/蓝牙/NFC)</li> |
| <li>传入测试参数</li> |
| <li>由自动化测试框架对特定的测试用例执行设置或拆解</li> |
| </ul> |
| |
| </body></html> |