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

相关推荐

  • linux rootfs制作_pdf镜像翻转设置

    linux rootfs制作_pdf镜像翻转设置在编译目录的osdev/pub/下找到rootfs_uclibc.tgz解压开按照上节和本节验证成功的部署这个rootfs手工制作rootfs.jffs2镜像,再烧录测试即可osdrv/pub/bin/pc/mkfs.jffs2-dosdrv/pub/rootfs_uclibc-l-e0x10000-oosdrv/pub/rootfs_uclibc_64k.jffs2注…

    2022年10月7日
  • 超级搜索术

    超级搜索术WeixinSogouSearchZhihuSogouSearch

    2022年7月18日
  • PHP批量去除bom头代码的小工具

    PHP批量去除bom头代码的小工具

    2021年9月22日
  • maven 项目打jar包 并包含所有依赖「建议收藏」

    maven 项目打jar包 并包含所有依赖「建议收藏」背景:基于最近项目部署,需要打jar包,然后涉及接口调用,反复测试,出现了各种问题,最后找到合理方案,特做以下总结:一、延伸知识:Springboot打jar包命令1.把之前打过的包通通干掉mvnpackageclean-Dmaven.test.skip=true2.重新打包mvnpackage-Dmaven.test.skip=true3.Springboot的打包插件<build><plugins>&

    2022年6月19日
  • mask rcnn实现教程「建议收藏」

    mask rcnn实现教程「建议收藏」一,首先去github上下载mask-rcnn源码,这里提供一个百度网盘地址链接:https://pan.baidu.com/s/1htJYyNy密码:0r2b含可运行DEMO更新链接:https://pan.baidu.com/s/1HBPtIPz0xpZsCprl7rc6hw密码:bvm5二,下载对应的mask_rcnn_coco.h5模型,这里给出百度网盘下载地址链接:h……

    2022年10月4日
  • Kibana介绍、安装和使用「建议收藏」

    Kibana介绍、安装和使用「建议收藏」ES之Kibana下面就Kibana对ES的查询监控作介绍,就是常提到的大数据日志处理组件ELK里的K。  什么是Kibana?现引用园友的一段对此的介绍,个人觉得比较全。  Kibana是一个针对Elasticsearch的开源分析及可视化平台,用来搜索、查看交互存储在Elasticsearch索引中的数据。使用Kibana,可以通过各种图表进行高级数据分析及展示。  Kibana让海量数据更容…

    2022年6月11日

发表回复

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

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