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


相关推荐

  • Python中break和continue的区别

    Python中break和continue的区别大部分人总是会搞混break和continue,虽然他们都是结束循环,但是结束的方式并不一样。break用于结束整个循环。continue用于结束当前循环。**1.**break有时候我们写代码时想让它结束整个循环,除了条件达到False结束,我们可以设定一个条件,当他达到这个条件时,结束整个循环。break用于完全跳出循环,执行循环体后面的语句。whileTrue:s=i…

    2022年5月26日
    41
  • 重定向与转发的区别以及实现_重定向与转发

    重定向与转发的区别以及实现_重定向与转发一、转发和重定向的区别request.getRequestDispatcher()是容器中控制权的转向,在客户端浏览器地址栏中不会显示出转向后的地址;服务器内部转发,整个过程处于同一个请求当中。response.sendRedirect()则是完全的跳转,浏览器将会得到跳转的地址,并重新发送请求链接。这样,从浏览器的地址栏中可以看到跳转后的链接地址。不在同一个请求。重定向,实际上客户端会向服务器端发送两个请求。所以转发中数据的存取可以用request作用域:request.setAtt…

    2025年7月11日
    0
  • 《大话数据结构》边读边感

    《大话数据结构》边读边感第一章:数据结构绪论数据结构:是相互之间存在一种或多种特定关系的数据元素的集合。数据:是描述客观事物的符号,式计算机可以操作的对象,是能被计算机识别,并输入给计算机处理的符号集合。数据输入有两个前提:1、可以输入的计算机中;2、能被计算机程序处理数据元素:是组成数据的,有一定意义的基本单位,在计算机中通常作为整体处理。也被称为记录。数据项:一个数据元素可以由若干个数据项组成;数据项数据不可

    2022年6月24日
    23
  • 图的基本算法(BFS和DFS)(转载)

    图的基本算法(BFS和DFS)(转载)

    2022年3月2日
    39
  • 无锁编程介绍

    无锁编程介绍原文地址:http://preshing.com/20120612/an-introduction-to-lock-free-programming文章目录无锁编程是什么无锁编程技术原子的Read-Modify-Write操作Compare-And-Swap循环顺序一致性内存保序不同的处理器有不同的内存模型参考文献无锁编程是一项挑战,不仅仅是因为自身的复杂性所致,还与初次探索该课题的困难…

    2022年6月10日
    25
  • 彻底弄懂LSH之simHash算法[通俗易懂]

    彻底弄懂LSH之simHash算法[通俗易懂]马克·吐温曾经说过,所谓经典小说,就是指很多人希望读过,但很少人真正花时间去读的小说。这种说法同样适用于“经典”的计算机书籍。最近一直在看LSH,不过由于matlab基础比较差,一直没搞懂

    2022年8月5日
    2

发表回复

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

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