#4 楼 @seveniruby 万变不离 wd, 放到手机的话,可能安卓可以由第三方来开发。 ios 估计得苹果自己来了。
#2 楼 @seveniruby 恩,所以 appium 还是能成为中坚
大致说了三件事,
#2 楼 @kratos0517 能否将代码用代码块包括起来。比如:
adb pull /sdcard/images/ E:\tmp
能不修改,用 stub 么?
建议数据库那边放出的接口单独做接口测试。 页面测试就做集成测试吧。测试用例还是按照 页面流 来的直观,再加入数据驱动增加覆盖率。
npm 安装比较好
➜ ~ adb shell
root@generic:/ # busybox
/system/bin/sh: busybox: not found
127|root@generic:/ # busybox
/system/bin/sh: busybox: not found
127|root@generic:/ # grep
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[pattern] [file ...]
#37 楼 @xiaomayi0323 appreciate ~ @luyi0824 是不是要先放上去吧? 其实你看代码 就知道没有把 app 烧到真机上的代码。
appium 也可以用 cucumber 哦。和 Calabash-android 应该没大区别。
@guo 快来
@luyi0824 @xiaomayi0323 你们的应用本身在真机上能运行嘛?
@luyi0824 你在模拟器上能运行么? xcode 必须 5.0.2 或者以上
@luyi0824 你没按我的步骤啊。。。 bundle id 不对
#5 楼 @luyi0824 我重启了下 mac 后, 可以了 运行成功。
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"device":"iPhone Simulator","platform":"Mac","browserName":"","version":"6.0","app":"io.appium.TestApp"}}
info: App is an iOS bundle, will attempt to run as pre-existing
info: Creating new appium session bcc46555-24e6-46b0-b725-d1d4b462af08
info: Removing any remaining instruments sockets
info: Cleaned up instruments socket /tmp/instruments_sock
info: Cleaning up any tracedirs
info: No tracedirs to clean up
info: Localizable.strings is not currently supported when using real devices.
info: Not setting device type since we're connected to a device
info: Starting iOS device log capture via idevicesyslog
debug: Real device specified but no ipa, assuming bundle ID is on device
debug: Creating instruments
info: instruments is: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: [INSTSERVER] Instruments socket server started at /tmp/instruments_sock
info: Attempting to run app on real device with UDID 45f082689dbaebb0ffa3620b3ae22ad9faff9a30
info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w 45f082689dbaebb0ffa3620b3ae22ad9faff9a30 io.appium.TestApp -e UIASCRIPT /usr/local/lib/node_modules/appium/lib/devices/ios/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments/
info: And extra without-delay env: {}
info: And launch timeout: 90000ms
info: [INSTSERVER] Instruments is ready to receive commands
info: Instruments launched. Starting poll loop for new commands.
info: Setting initial orientation to PORTRAIT
info: Pushing command to appium work queue: "au.setScreenOrientation('PORTRAIT')"
debug: Sending command to instruments: au.setScreenOrientation('PORTRAIT')
info: [INSTSERVER] Socket data received (15 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Sending command to instruments: au.setScreenOrientation('PORTRAIT')
info: [INSTSERVER] Socket data received (56 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":"PORTRAIT"}
info: Device launched! Ready for commands (will time out in 60secs)
info: Appium session started with sessionId bcc46555-24e6-46b0-b725-d1d4b462af08
POST /wd/hub/session 303 46032ms - 9b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08
debug: Request received with params: {}
info: Responding to client with success: {"status":0,"value":{"version":"6.0","webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"Mac","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"device":"iPhone Simulator","app":"io.appium.TestApp"},"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
GET /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08 200 2ms - 382b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/elements
debug: Request received with params: {"using":"tag name","sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","value":"textField"}
info: Pushing command to appium work queue: "au.getElementsByType('textField')"
debug: Sending command to instruments: au.getElementsByType('textField')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('textField')
info: [INSTSERVER] Socket data received (79 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"0"},{"ELEMENT":"1"}]}
info: Responding to client with success: {"status":0,"value":[{"ELEMENT":"0"},{"ELEMENT":"1"}],"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
POST /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/elements 200 1193ms - 157b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/0/value
debug: Request received with params: {"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","id":"0","value":["1"]}
info: Pushing command to appium work queue: "au.getElement('0').setValueByType('1')"
debug: Sending command to instruments: au.getElement('0').setValueByType('1')
info: [INSTSERVER] Sending command to instruments: au.getElement('0').setValueByType('1')
info: [INSTSERVER] Socket data received (48 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
info: Responding to client with success: {"status":0,"value":"","sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
POST /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/0/value 200 2348ms - 87b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/1/value
debug: Request received with params: {"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","id":"1","value":["5"]}
info: Pushing command to appium work queue: "au.getElement('1').setValueByType('5')"
debug: Sending command to instruments: au.getElement('1').setValueByType('5')
info: [INSTSERVER] Sending command to instruments: au.getElement('1').setValueByType('5')
info: [INSTSERVER] Socket data received (48 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
info: Responding to client with success: {"status":0,"value":"","sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
POST /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/1/value 200 1820ms - 87b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/elements
debug: Request received with params: {"using":"tag name","sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","value":"button"}
info: Pushing command to appium work queue: "au.getElementsByType('button')"
debug: Sending command to instruments: au.getElementsByType('button')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('button')
info: [INSTSERVER] Socket data received (143 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"},{"ELEMENT":"5"},{"ELEMENT":"6"},{"ELEMENT":"7"}]}
info: Responding to client with success: {"status":0,"value":[{"ELEMENT":"2"},{"ELEMENT":"3"},{"ELEMENT":"4"},{"ELEMENT":"5"},{"ELEMENT":"6"},{"ELEMENT":"7"}],"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
POST /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/elements 200 1326ms - 293b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/2/click
debug: Request received with params: {"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","id":"2"}
info: Pushing command to appium work queue: "au.tapById('2')"
debug: Sending command to instruments: au.tapById('2')
info: [INSTSERVER] Sending command to instruments: au.tapById('2')
info: [INSTSERVER] Socket data received (50 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":null}
info: Responding to client with success: {"status":0,"value":null,"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
POST /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/2/click 200 1174ms - 89b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/elements
debug: Request received with params: {"using":"tag name","sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","value":"staticText"}
info: Pushing command to appium work queue: "au.getElementsByType('staticText')"
debug: Sending command to instruments: au.getElementsByType('staticText')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('staticText')
info: [INSTSERVER] Socket data received (96 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"8"},{"ELEMENT":"9"},{"ELEMENT":"10"}]}
info: Responding to client with success: {"status":0,"value":[{"ELEMENT":"8"},{"ELEMENT":"9"},{"ELEMENT":"10"}],"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
POST /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/elements 200 1347ms - 192b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/8/text
debug: Request received with params: {"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08","id":"8"}
info: Pushing command to appium work queue: "au.getElement('8').text()"
debug: Sending command to instruments: au.getElement('8').text()
info: [INSTSERVER] Sending command to instruments: au.getElement('8').text()
info: [INSTSERVER] Socket data received (49 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":"6"}
info: Responding to client with success: {"status":0,"value":"6","sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
GET /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08/element/8/text 200 939ms - 88b
debug: Appium request initiated at /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08
debug: Request received with params: {"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
info: Shutting down appium session...
info: Stopping ios
info: [INST] 2013-12-06 10:50:50 +0000 Debug: target.setDeviceOrientation("1")
2013-12-06 10:50:53 +0000 Debug: target.frontMostApp().elements()[0].elements()[0].tap()
2013-12-06 10:50:54 +0000 Debug: target.frontMostApp().keyboard().typeString("1")
2013-12-06 10:50:55 +0000 Debug: target.frontMostApp().elements()[0].elements()[1].tap()
2013-12-06 10:50:56 +0000 Debug: target.frontMostApp().keyboard().typeString("5")
2013-12-06 10:50:58 +0000 Debug: target.frontMostApp().elements()[0].elements()[2].tap()
2013-12-06 10:51:00 +0000 Stopped: Script was stopped by the user
Instruments Trace Complete (Duration : 52.047413s; Output : /Users/Apple/instrumentscli0.trace)
info: [INSTSERVER] Instruments exited with code 0
info: Stopping iOS log capture
info: [INSTSERVER] Socket closed forcibly due to exit
info: [INSTSERVER] Instruments socket server closed
info: Deleted tracedir we heard about from instruments (/Users/Apple/instrumentscli0.trace)
info: Cleaning up appium session
info: Responding to client with success: {"status":0,"value":null,"sessionId":"bcc46555-24e6-46b0-b725-d1d4b462af08"}
DELETE /wd/hub/session/bcc46555-24e6-46b0-b725-d1d4b462af08 200 583ms - 89b
➜ python git:(master) ✗ python simple_real_device.py
.
----------------------------------------------------------------------
Ran 1 test in 56.793s
OK
➜ python git:(master) ✗
@luyi0824 首先你启动 appium 的时候
比如
appium -U 45f082689dbaebb0ffa3620b3ae22ad9faff9a30 --app io.appium
然后再去运行脚本。比如源码的案例下面的 examples/python/simple_real_device.py
理论上是这样,不过我遇到了一些问题。 没有成功的运行起来。
@meimeiyuyun 他说你 app 的地址不对╮(╯_╰)╭。 加个头像吧~