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培训_泰山区岱岳javaEE开发职业学校_java编程「建议收藏」

    泰安北大青鸟 Java培训_泰山区岱岳javaEE开发职业学校_java编程「建议收藏」泰安北大青鸟为您导航泰山区岱岳javaEE开发职业学校,java编程,欢迎来电!泰安北大青鸟泰山区岱岳javaEE开发职业学校,环境变量规范的说是操作系统中运来指定操作系统运行环境的一些参数,当要求系统运行一个程序而没有告诉程序的完整路径时,泰安JA编程培训系统除了在当前下面寻找此程序外,还应道path中指定的路径去找,泰安JA开发培训这就是环境变量的作用。什么是jdk环境变量配置?由于C++所具…

    2022年7月8日
  • jsp传后台乱码 encodeURI

    jsp传后台乱码 encodeURI

    2022年3月6日
  • Java Web安全之代码审计

    Java Web安全之代码审计信息安全的75%发生在Web应用而非网络层。本文内容主要以JavaWeb安全-代码审计为中心展开。一、JavaWeb安全基础1.何为代码审计?通俗的说Java代码审计就是通过审计Java代码来发现Java应用程序自身中存在的安全问题,由于Java本身是编译型语言,所以即便只有class文件的情况下我们依然可以对Java代码进行审计。对于未编译的Java源代码文件我们可以直接阅读其…

    2022年7月8日
  • springboot 上传文件设置文件大小限制

    springboot 上传文件设置文件大小限制报错内容:org.springframework.web.multipart.MaxUploadSizeExceededException:Maximumuploadsizeexceeded;nestedexceptionisjava.lang.IllegalStateException:org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException:therequestwasrejectedbe…

    2022年5月29日
  • hard code什么意思_hardcoding什么意思

    hard code什么意思_hardcoding什么意思写死(英文称hardcode,hardcoding)指的是在软体实作上,把输出或输入的相关参数(例如:路径、输出的形式、格式)直接写死在原始码中,而非在执行时期由外界指定的设定、资源、资料、或者格式做出适当回应…

    2022年10月24日
  • JAVA设计模式——适配器模式

    JAVA设计模式——适配器模式适配器模式是一种结构型设计模式。适配器模式的思想是:把一个类的接口变换成客户端所期待的另一种接口,从而使原本因接口不匹配而无法在一起工作的两个类能够在一起工作。用电器来打个比喻:有一个电器的插头是三脚的,而现有的插座是两孔的,要使插头插上插座,我们需要一个插头转换器,这个转换器即是适配器。适配器模式涉及3个角色:源(Adaptee):需要被适配的对象或类型,相当于插头。适配器(Ad

    2022年7月25日

发表回复

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

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