測试开启前的设备系统准备工作。

接口

  1. /*
  2. * Copyright (C) 2010 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.android.tradefed.targetprep;
  17.  
  18. import com.android.tradefed.build.IBuildInfo;
  19. import com.android.tradefed.device.DeviceNotAvailableException;
  20. import com.android.tradefed.device.ITestDevice;
  21.  
  22. /**
  23. * Prepares the test environment for the test run.
  24. * <p/>
  25. * For example, installs software, tweaks env settings for testing, launches targets etc.
  26. * <p/>
  27. * Note that multiple {@link ITargetPreparer} can specified in a configuration. It is recommended
  28. * that each ITargetPreparer clearly document its expected environment pre-setup and post-setUp.
  29. * e.g. a ITargetPreparer that configures a device for testing must be run after the ITargetPreparer
  30. * that installs software.
  31. */
  32. public interface ITargetPreparer {
  33.  
  34. /**
  35. * Perform the target setup for testing.
  36. *
  37. * @param device the {@link ITestDevice} to prepare.
  38. * @param buildInfo data about the build under test.
  39. * @throws TargetSetupError if fatal error occurred setting up environment
  40. * @throws DeviceNotAvailableException if device became unresponsive
  41. */
  42. public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError,
  43. BuildError, DeviceNotAvailableException;
  44. }

就一个方法:setUp(),比方你要安装系统、安装apk或者其它都是case要求的安装事务都要在这种方法中完毕。

实现类

  1. /*
  2. * Copyright (C) 2010 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.android.tradefed.targetprep;
  17.  
  18. import com.android.ddmlib.Log;
  19. import com.android.tradefed.build.IBuildInfo;
  20. import com.android.tradefed.device.ITestDevice;
  21.  
  22. /**
  23. * Placeholder empty implementation of a {@link ITargetPreparer}.
  24. */
  25. public class StubTargetPreparer implements ITargetPreparer {
  26.  
  27. /**
  28. * {@inheritDoc}
  29. */
  30. @Override
  31. public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError {
  32. Log.d("TargetPreparer", "skipping target prepare step");
  33. }
  34. }

这个类里面的方法就是打印了一句话。没做不论什么处理。可是真正要是满足自己特定的需求就要自己写一个类继承与该接口才行。

Cts框架解析(12)-ITargetPreparer的更多相关文章

  1. Cts框架解析(2)-cts调试环境的搭建

    上一篇文章中说了怎样在windows搭建cts以及执行cts进行測试.这篇文章来讲讲怎样在eclipse中配置源代码,进行debug调试. 下载 cts源代码地址:https://android.go ...

  2. Cts框架解析(8)-IBuildProvider

    IBuildProvider接口中定义了三个方法 /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under ...

  3. Cts框架解析(7)-任务运行的调度室

    TestInvocation /** * {@inheritDoc} */ @Override public void invoke(ITestDevice device, IConfiguratio ...

  4. Cts框架解析(6)-任务的运行

    前两篇讲了任务的加入和9大项配置,这篇讲任务的运行. 任务的运行 任务的运行在CommandScheduler的run方法中,所以删除全部的断点,在run方法中打上断点,重新启动启动debug: 先看 ...

  5. Cts框架解析(1)-windows下cts配置

    环境搭建 下载 cts工具的下载地址:http://source.android.com/compatibility/downloads.html windows选择Android4.4 R3 Com ...

  6. Cts框架解析(15)-任务运行完

    case运行完成后.会回到CtsTest的run方法中: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaXRmb290YmFsbA==/font/5a6L ...

  7. [源码解析] 深度学习分布式训练框架 horovod (12) --- 弹性训练总体架构

    [源码解析] 深度学习分布式训练框架 horovod (12) --- 弹性训练总体架构 目录 [源码解析] 深度学习分布式训练框架 horovod (12) --- 弹性训练总体架构 0x00 摘要 ...

  8. Poco::TCPServer框架解析

    Poco::TCPServer框架解析 POCO C++ Libraries提供一套 C++ 的类库用以开发基于网络的可移植的应用程序,功能涉及线程.文件.流,网络协议包括:HTTP.FTP.SMTP ...

  9. AlexeyAB DarkNet YOLOv3框架解析与应用实践(六)

    AlexeyAB DarkNet YOLOv3框架解析与应用实践(六) 1. Tiny Darknet 听过很多人谈论SqueezeNet. SqueezeNet很酷,但它只是优化参数计数.当大多数高 ...

随机推荐

  1. .Net刷新页面的小结

    现在给大家讲讲在.Net中书信页面的几种方式: 第一: private void Button1_Click( object sender, System.EventArgs e ) { Respon ...

  2. Android Dialog用法

    摘要: 创建对话框 一个对话框一般是一个出现在当前Activity之上的一个小窗口. 处于下面的Activity失去焦点, 对话框接受所有的用户交互. 对话框一般用于提示信息和与当前应用程序直接相关的 ...

  3. delphi 设置表格样式。

    //设置表格样式 wordDoc.Tables.Item(1).Borders.Item(Word.WdBorderType.wdBorderLeft).LineStyle = Word.WdLine ...

  4. IOS 时间 日历 处理集合

    1.获得当前时间 从1970开始的秒数 NSTimeInterval time = [[NSDate date[ timeIntervalSince1970]]; NSString * str = [ ...

  5. 同行评审 Peer Review

    周五的课上,章老师给我们上了一节关于同行评审(Peer Review)的课程,让我了解了以前并不熟悉的这一过程.课上我们就姚思丹同学项目组做的项目,分组进行了审查. 首先介绍一下同行评审(Peer R ...

  6. RockMongo安装使用笔记

    下载nginx最新版本下载PHP,5.X版本即可,非线程安全的的,因为nginx用的是fastcgi下载rockmongo最新版本下载php_mongo组件 在rockmongo里的readme里有下 ...

  7. C 实现的算法篇

    算法的定义:算法是解决实际问题的一种精确的描述方法,目前,广泛认同的定义是:算法的模型分析的一组可行的确定的和有穷的规则 算法的五个特性:有穷性,确切性,输入,输出,可行性.目前算法的可执行的步骤非常 ...

  8. reverse the string word by word

    题目:Given an input string, reverse the string word by word. For example,Given s = "the sky is bl ...

  9. Java处理InterruptedException异常小结

    对于InterruptedException,一种常见的处理方式是捕捉它,然后什么也不做(或者记录下它,不过这也好不到哪去).不幸的是,这种方法忽略了这样一个事实:这期间可能发生中断,而中断可能导致应 ...

  10. HTML5每日一练之input新增加的URL类型与email类型应用

    1.URL类型: <form> <input name="urls" type="url" value="http://www.w3 ...