Robot Framework+Appium案例分享四: Bluetooth测试
来源:互联网 发布:柏原崇 知乎 编辑:程序博客网 时间:2024/06/05 12:47
在之前的博客“Robot Framework + Appium测试Android设备”,我们已经介绍了如何使用Robot Framework和Appium测试Android设备,如果对这部分还不熟悉的童鞋,可以参考本人之前的博客。
本文分享一个Test Suit, Bluetooth测试, 包括蓝牙打开, 扫描, 连接.
Test Suit 6, Bluetooth测试, 包括蓝牙打开, 扫描, 连接.
测试步骤如下,
1. 打开Setting App;
2. 点击进入Bluetooth页面;
2.1 Test Case 1: 打开蓝牙;
2.2 Test Case 2: 蓝牙扫描;
2.3 Test Case 3: 蓝牙连接;
示例代码如下,
*** Settings ***Suite Setup Open Settings AppSuite Teardown Close ApplicationLibrary AppiumLibrary*** Variables ***${BT_HEADSET_NAME} BTD110*** Test Cases ***Test Case 1: Turn On Bluetooth [Tags] Bluetooth Test Turn On BluetoothTest Case 2: Refresh Bluetooth [Tags] Bluetooth Test Refresh Bluetooth Device ListTest Case 3: Connect Bluetooth [Tags] Bluetooth Test Connect Bluetooth Headset ${BT_HEADSET_NAME}*** Keywords ***Open Settings App Open Application http://localhost:4723/wd/hub platformName=Android platformVersion=6.0.1 deviceName=dev_name appPackage=com.android.settings appActivity=.Settings Sleep 2s Open Bluetooth Setting PageOpen Bluetooth Setting Page Log Click the "Bluetooth" Label Wait Until Page Contains Element xpath=//*[contains(@text, 'Bluetooth')] 10 Can NOT find "Bluetooth" label Click Element xpath=//*[contains(@text, 'Bluetooth')]Turn On Bluetooth Wait Until Page Contains Element xpath=//*[contains(@resource-id, 'id/switch_widget')] Sleep 1s ${wifi_status} = Get Element Attribute xpath=//*[contains(@resource-id, 'id/switch_widget')] text Run Keyword If '${wifi_status}' != 'ON' Click Element xpath=//*[contains(@resource-id, 'id/switch_widget')]Refresh Bluetooth Device List Click Element xpath=//*[contains(@content-desc, 'More options')] Sleep 2s Wait Until Page Contains Element xpath=//*[contains(@text, 'Refresh')] 20 Can NOT find "Refresh" ${count} Get Matching Xpath Count xpath=//*[contains(@text, 'Refresh')] Run Keyword If ${count} > 0 Click Element xpath=//*[contains(@text, 'Refresh')]Connect Bluetooth Headset [Arguments] ${bluetooth_name} Log Step 1: Click the headset ${bluetooth_name} Wait Until Page Contains Element xpath=//*[contains(@text, '${bluetooth_name}')] 10 Can NOT find ${bluetooth_name} Click Element xpath=//*[contains(@text, '${bluetooth_name}')] Sleep 2s ${count} Get Matching Xpath Count xpath=//*[contains(@resource-id, 'alertTitle')] Run Keyword If ${count} > 0 Click Element xpath=//*[contains(@text, 'OK')] Sleep 2s Run Keyword If ${count} > 0 Click Element xpath=//*[contains(@text, '${bluetooth_name}')] Log Check if the Bluetooth connected sucesfully or not. Wait Until Page Contains Connected 10 The device does NOT connect to the Access Point ${bluetooth_name} yet
文末列出最近整理的Robot Framework相关的文章,
1.Robot Framework 介绍
2.Robot Framework + Appium测试Android设备
3. Robot Framework如何向Android发送keycode键盘事件
4.Robot Framework如何判断Android屏幕是否含有某个控件
5.Robot Framework如何等待Android屏幕中的某个控件出现
6.Robot Framework如何在Android中实现滚屏
7.Robot Framework如何对Android的控件定位
8.Robot Framework+Appium案例分享一: 验证版本信息
9.Robot Framework+Appium案例分享二: Camera测试
10.Robot Framework+Appium案例分享三: WiFi测试
11.Robot Framework+Appium案例分享四: Bluetooth测试
12.RobotFramework AppiumLibrary 用户关键字
- Robot Framework+Appium案例分享四: Bluetooth测试
- Robot Framework+Appium案例分享二: Camera测试
- Robot Framework+Appium案例分享三: WiFi测试
- Robot Framework+Appium案例分享一: 验证版本信息
- Robot Framework + Appium测试Android设备
- Robot Framework自动化测试 ---文档分享
- Robot Framework自动化测试(四)--- 分层思想
- Robot Framework自动化测试(四)--- 分层思想
- Robot Framework自动化测试(四)--- 分层思想
- Robot Framework 测试总结
- Robot Framework自动化测试
- robot framework 测试安装
- Robot Framework自动化测试
- 使用Robot Framework+Appium进行自动化
- Robot Framework +Appium的简单教程
- Robot + Appium 搭建 iOS 自动化测试环境
- Robot Framework自定义测试库
- 自动化测试框架Robot Framework
- Tensorflow学习之卷积神经网络实现(六)
- H5性能优化方面的探索
- 数据结构复习之排序篇
- 设置select宽度
- 剑指offer 21 包含min函数的栈
- Robot Framework+Appium案例分享四: Bluetooth测试
- mongokit 与 mongoengine 区别
- maven的讲解(pom.xml)
- EL表达式(目的简化代码)
- 国内交易平台关闭了,教你如何把Zcash(zec)兑换成人民币
- java多线程yield
- Gradle——依赖管理和多项目构建
- php的计划任务 使用crontab
- 【2-SAT】2sat问题小结