Cts框架解析(12)-ITargetPreparer

Cts框架解析(12)-ITargetPreparer

大家好,又见面了,我是全栈君。

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

接口

/*
 * Copyright (C) 2010 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.
 */
package com.android.tradefed.targetprep;

import com.android.tradefed.build.IBuildInfo;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;

/**
 * Prepares the test environment for the test run.
 * <p/>
 * For example, installs software, tweaks env settings for testing, launches targets etc.
 * <p/>
 * Note that multiple {@link ITargetPreparer} can specified in a configuration. It is recommended
 * that each ITargetPreparer clearly document its expected environment pre-setup and post-setUp.
 * e.g. a ITargetPreparer that configures a device for testing must be run after the ITargetPreparer
 * that installs software.
 */
public interface ITargetPreparer {

    /**
     * Perform the target setup for testing.
     *
     * @param device the {@link ITestDevice} to prepare.
     * @param buildInfo data about the build under test.
     * @throws TargetSetupError if fatal error occurred setting up environment
     * @throws DeviceNotAvailableException if device became unresponsive
     */
    public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError,
            BuildError, DeviceNotAvailableException;
}

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

实现类

/*
 * Copyright (C) 2010 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.
 */
package com.android.tradefed.targetprep;

import com.android.ddmlib.Log;
import com.android.tradefed.build.IBuildInfo;
import com.android.tradefed.device.ITestDevice;

/**
 * Placeholder empty implementation of a {@link ITargetPreparer}.
 */
public class StubTargetPreparer implements ITargetPreparer {

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError {
        Log.d("TargetPreparer", "skipping target prepare step");
    }
}

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/115443.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • PS制作CSS精灵图

    PS制作CSS精灵图精灵图简介1.精灵图(雪碧图)(1)问题:精灵图就是将很多的小图标合并到一张较大的图片中,那精灵是啥意思呢?(为此笑了一下午的我)。(2)精灵图也称雪碧图,由于大型网页首次加载需要时间,如果再加之加载小图标的时间,则会严重影响到用户体验。所以,考虑到在同一时间内,服务器拥堵的情况,使用精灵图来解决这一问题。那么怎么制作精灵图呢2.使用ps制作精灵图的详细步骤示例:将如下图图片中的四个图…

    2022年6月7日
    182
  • linux内核版本和发行版本的区别_linux内核版本号的构成

    linux内核版本和发行版本的区别_linux内核版本号的构成Linux的内核版本和发行版本1.内核版本内核是系统的心脏,是运行程序和管理像磁盘和打印机等硬件设备的核心程序,它提供了一个在裸设备与应用程序间的抽象层。例如,程序本身不需要了解用户的主板芯片集或磁盘控制器的细节就能在高层次上读写磁盘。内核的开发和规范一直是由Linus领导的开发小组控制着,版本也是惟一的。开发小组每隔一段时间公布新的版本或其修订版,从1991年10月Linus向世界…

    2022年8月23日
    6
  • win10cpu睿频怎么关闭_cpu睿频上不去

    win10cpu睿频怎么关闭_cpu睿频上不去笔记本非节能模式下默认开睿频,非常烫手。关闭睿频,步骤如下:打开注册表编辑器=>地址栏输入=>将值改为0=>打开——>——>——>——>——>设置为非要打开睿频的话,笔记本建议使用高性能高效率,频率高,温度相对低,算是一个折中的方案。台式机不清楚,自行测试,可以使用CoreTemp监控温度和频率。…

    2022年9月15日
    0
  • Java基础问题整理「建议收藏」

    备注:针对基本问题做一些基本的总结,不是详细解答!1.HashMap和ConcurrentHashMap区别(必考)2.ConcurrentHashMap的数据结构(必考)3.高并发HashMap的环是如何产生的4.HashMap1.7与HashMap1.8的区别,从数据结构上、Hash值的计算上、链表数据的插入方法、内部Entry类的实现上分析?5.Hash1.7是基于数组…

    2022年4月6日
    33
  • 主机游戏神作和排行榜

    主机游戏神作和排行榜文章目录主机游戏任天堂、索尼、微软三大家任天堂索尼微软其他电视游戏主机(家用机)红白机时代PS时代次世代主机掌机其他游戏PC游戏平台Steam其他评分和榜单端游、页游和手游评分和榜单VR设备ValveIndexHTCViveOculusRiftSOculusQuest三星MR+权威游戏评分媒体TGAIGNGameSpot其他GameRankingsFami通MetacriticEGA游戏…

    2022年7月11日
    81
  • 哈佛大学幸福课笔记一「建议收藏」

    哈佛大学幸福课笔记一「建议收藏」Happinessismuchmorecontignentonourstateofmind thanoursstatusorthestateofourbankaccount.快乐是由我们的精神状态决定,而不是社会地位或银行存款。Lao

    2022年7月18日
    17

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号