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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • java 对象为空判断_java中判断对象是否为空的方法

    java 对象为空判断_java中判断对象是否为空的方法判断Java对象是否为null的方法:首先,直接使用object==null去判断,对象为null的时候返回true,不为null的时候返回false。然后,在object!=null为true的情况下,进一步去判断对象的所有属性是否为null。实例:packagecom.gj5u.publics.util;importjava.util.List;/***判断对象是否为空**…

    2022年5月2日
    261
  • 2021 navicat激活码最新_最新在线免费激活

    (2021 navicat激活码最新)本文适用于JetBrains家族所有ide,包括IntelliJidea,phpstorm,webstorm,pycharm,datagrip等。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月27日
    142
  • redis默认端口为什么是6379_redis 端口

    redis默认端口为什么是6379_redis 端口1、如果开了redis服务,先将服务关闭2、在window上找到redis的安装目录,修改redis.windows.conf文件,在里面将默认端口改为你想要的端口号3、将redis.windows.conf文件直接拖入redis-server.exe,弹出窗口

    2022年9月18日
    3
  • 树莓派配置记录——aria2

    aria2是linux下的一个下载利器,支持http/BT/磁力连。本身是命令行程序,支持rpc连接,因此可以编程控制,github上有很多优秀的webUI,非常适合树莓派。aria2本身的配置选项很多,完整的列表在这里下面是我的配置,放在~/.aria2/aria2.config文件中#默认下载路径dir=/home/pi/Downloads#下载前预创建文件,ext4可…

    2022年4月7日
    120
  • 解决pycharm中使用pip安装numpy失败的问题「建议收藏」

    解决pycharm中使用pip安装numpy失败的问题「建议收藏」今天使用pycharm编译python程序时,由于要调用numpy包,但又未曾安装numpy,于是就根据pycharm的提示进行安装,最后竟然提示出错!!!如下图:这不是要让我回归命令行的生活吗?!解决方案如下:1、下载numpy-1.19.5-cp39-cp39-win_amd64.whl,网址是https://pypi.org/project/numpy/#files2、将下载好的numpy文件放在python安装路径下的/scripts中3、在命令行状态下切换到script

    2022年8月29日
    6
  • mybatisplus iservice接口(iphone 8 plus怎么样)

    Mybatis-plus之IService的使用

    2022年4月10日
    128

发表回复

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

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