android自动化测试工具【UiAutomator】——打开settings实例

本文提供了一个使用UiAutomator进行自动化测试的实例,详细阐述了如何从主屏幕出发,模拟用户操作打开Settings应用的步骤,包括点击All Apps按钮,进入Apps tab,水平滚动找到Settings图标并点击验证Settings应用是否正确启动。
摘要由CSDN通过智能技术生成

   以下为使用UiAutomation打开settings的一个标本实例,来简单说明使用该工具的测试步骤

package com.uia.example.my;

//导入需要的内容
import android.os.RemoteException;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiScrollable;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;

public class LaunchSettings extends UiAutomatorTestCase {   

   public void testDemo() throws UiObjectNotFoundException, RemoteException {   
      
      System.out.println("My first time to use it") ;
       
      // Simulate a short press on the HOME button. 模拟点击home键
      getUiDevice().pressHome();
      System.out.println("Step 1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值