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 嵌入式 tts引擎_语音合成(TTS)的概念和分类[通俗易懂]

    linux 嵌入式 tts引擎_语音合成(TTS)的概念和分类[通俗易懂]智能音箱在ASR(语音识别)以及NLP自然语义处理常用框架-兔尔摩斯的文章-知乎https://zhuanlan.zhihu.com/p/55658291语音合成SpeechSynthesis或TexttoSpeech(TTS)语音合成(SpeechSynthesis)是人类语音的人工合成。用于此目的的计算机系统称为语音计算机或语音合成器,可以在软件或硬件产品中实…

    2022年4月19日
    280
  • c语言getchar()的用法_c=getchar()

    c语言getchar()的用法_c=getchar()文章目录getchar()函数定义函数返回值注意区分getchar和scanfgetchar的使用实例getchar()函数定义getchar()-字符输入函数,没有参数,从输入缓冲区里面读取一个字符-「一次只能读取一个字符」EOF(-1)-endoffile文件结束标志-键盘上用ctrl+z实现先查一下文档函数返回值该函数以无符号char强制转换为int的形式返回读取的字符,如果到达文件末尾或发生读取错误,则返回EOF(-1

    2022年10月18日
    3
  • 环信即时通讯——集成客户端

    环信即时通讯——集成客户端

    2021年11月9日
    65
  • 风控模型评价指标总结

    风控模型评价指标总结    下表为我在日常建模过程中,评价模型经常用到的一些指标。现在整理出来分享给大家,如果大家想知道每种指标的具体意义,还请大家查阅相关大佬的博文。小弟就不在这里班门弄斧了。…

    2022年5月27日
    39
  • vue的watch用法_vuewatch参数

    vue的watch用法_vuewatch参数watch:{“xx”:functtion(newValue,oldValue){console.log(newValue,oldValue)},immediate:true,//首次绑定值是否触发deep:true//深度监听}watch:{xx(newValue,oldValue){…

    2025年6月28日
    4
  • Java创建数组的方法

    Java创建数组的方法最近在学Java,一点小心得,希望和大家分享一下,第一次写文章,写的不好希望大家谅解,当然我也会尽力写好这篇文章!本章介绍的创建数组的各种方法,并对它们进行了对比和剖析,最后还扩展了一些知识。

    2022年6月7日
    36

发表回复

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

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