xcode自动化测试小试
来源:互联网 发布:网络电视直播软件apk 编辑:程序博客网 时间:2024/04/30 07:59
1:安装成功appium
然后安装: pip install Appium-Python-Client
然后安装:npm install appium-doctor -g
2:运行 appium-doctor --ios 检查是不是全部安装好了。
3:项目根目录路径下运行:
xcodebuild -sdk iphonesimulator
4:如果会有一些警告的话
运行:xcode-select --install
$ cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/
$ npm install -g carthage --HEAD
$ open
等。
5:在根目录放置测试脚本,并用python + xx.py 执行
"""Simple iOS tests, showing accessing elements and getting/setting text from them."""import unittestimport osfrom random import randintfrom appium import webdriverfrom time import sleepclass SimpleIOSTests(unittest.TestCase): def setUp(self): # set up appium app = os.path.abspath('/Users/zxj/Desktop/TestUITest/build/Release-iphonesimulator/TestUITest.app') self.driver = webdriver.Remote( command_executor='http://127.0.0.1:4723/wd/hub', desired_capabilities={ 'app': app, 'automationName':'XCUITest', 'platformName': 'iOS', 'platformVersion': '10.2', 'deviceName': 'iPhone 7' }) def tearDown(self): self.driver.quit() def test_ui_computation(self): print('begin work') self._testBtn() def _testBtn(self): try: el = self.driver.find_element_by_accessibility_id('hello') el.click() sleep(6) except: print('not work')if __name__ == '__main__':suite = unittest.TestLoader().loadTestsFromTestCase(SimpleIOSTests)unittest.TextTestRunner(verbosity=2).run(suite)
注意 路径和模拟器的版本等参数。
6:运行起来没问题,但是模拟器会自动关闭
/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphonesimulator
WebDriverAgent的framework安装的有问题,拷贝别人的好的framework就能fix。
部分问题可以用:sudo chown -R $(whoami) /usr/local 解决
7:项目地址
https://github.com/qianxunaimama/appIumTest.git
- xcode自动化测试小试
- xcode中的自动化测试
- 自动化测试小论
- 自动化测试小实例
- 在Xcode中进行自动化测试
- 小聊自动化测试工具和框架
- java 自动化测试小功能集锦
- Appium基于自动化测试的小实例
- 小白搭建自动化测试平台
- 在 Xcode 中进行自动化测试 (1/2)
- 在 Xcode 中进行自动化测试 (2/2)
- 在 Xcode 中进行自动化测试 (1/2)
- 在 Xcode 中进行自动化测试 (2/2)
- Xcode自带的instrument中的Automation实现自动化测试
- Xcode 单元测试小试
- android 自动化测试的傻瓜实践之旅(UI篇) -----小试身手
- 一个发包小程序 一种用于自动化测试的脚本语言
- 写自动化测试工具的一些小技巧
- mysql索引详解
- poj博弈n连刷
- 立业_b
- 微信小程序开发—重磅消息,张小龙公布小程序上线时间
- AngularJS 实现复选框 全选/取消全选
- xcode自动化测试小试
- 使用 python requests 模拟登陆
- MongoDB regular expression with indexed field
- yii2 widget实现筛选记录
- android模拟器,Genymotion问题:Unable to start the virtual device.
- unity 打包完成之后 (黑色控制台提示)
- 二叉树练习——建树+叶子数+深度
- 渗透工具之nmap使用
- Java回顾之序列化