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)
上一篇 2022年2月4日 上午11:00
下一篇 2022年2月4日 下午12:00


相关推荐

  • vc 调用dll_调用API

    vc 调用dll_调用APIGoogle公司已经将GoogleCOMAPI开放,这样我们就可以通过开放的API来对GoogleEarth进行操作了,比如控制当前视图的高度、中心经纬度,保存当前图片等等。下面是GoogleCOMAPI的网址:http://earth.google.com/comapi/那么,VC程序员如何使用这些API来控制GoogleEarth呢?下面我们编写一个简单的程序来说明对G

    2022年8月12日
    10
  • pycharm安装包说pip版本不对_django库

    pycharm安装包说pip版本不对_django库一、pycharm安装库与pip安装库的区别项目使用哪个解释器,就用哪个解释器下的库:python安装目录解释器就用该目录下的库,项目的解释器就用项目里面的库!而pip安装的库是保存在python安装目录解释器下的。“pip成功,pycharm识别不了”,这就是因为新建项目默认解释器是用“项目的解释器”的,但是pip安装的第三方库是在python安装目录下,所以会识别不了。这里我只把我需要知道的摘下来,具体友情链接:关于pip安装第三方库,但PyCharm中却无法识别的问题;以及PyCharm安装第三

    2022年8月26日
    7
  • oracle之表空间(tablespace)、方案(schema)、段(segment)、区(extent)、块(block)

    oracle之表空间(tablespace)、方案(schema)、段(segment)、区(extent)、块(block)

    2021年11月13日
    42
  • AvalonEdit

    AvalonEditAvalonEditAvalonEditisaWPF-basedtexteditorcomponent.Itwaswrittenby DanielGrunwald&#

    2022年7月2日
    38
  • HBuilder常用快捷键总结「建议收藏」

    HBuilder常用快捷键总结「建议收藏」HBuilder常用快捷键大概共9类(【4133】文件、编辑、插入;【498】选择、跳转、查找;【116】运行、工具、视图)1.文件(4)新建Ctrl+N关闭Ctrl+F4全部关闭Ctrl+Shift

    2022年5月6日
    195
  • murmurhash算法_shell dash使用数组

    murmurhash算法_shell dash使用数组MurmurHash 是一种非加密型哈希函数,适用于一般的哈希检索操作。[1][2][3] 由AustinAppleby在2008年发明,[4][5] 并出现了多个变种,[6] 都已经发布到了公有领域(publicdomain)。与其它流行的哈希函数相比,对于规律性较强的key,MurmurHash的随机分布特征表现更良好

    2022年10月19日
    7

发表回复

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

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