WebDriverAgent 是什么
去年的 SeleniumConf 上,Facebook 推出了一款新的iOS移动测试框架 —— WebDriverAgent,当时的推文上,写的还只支持模拟器。半年过过去了,如今在看官方github —— https://github.com/facebook/WebDriverAgent,已经宣称支持真机测试了(亲测的确支持)。我把它的 ReadMe 搬运过来:
它有如下特性:
- 真机和模拟器都支持
- 实现了大部分的 WebDriver spec
- USB support for devices,所谓的usb支持,指的是设备不需要上网,目前client binding 还没有。
- 提供了一个 Inspector
- Easy development cycle as it can be launched & debugged directly via Xcode
- Unsupported yet, but works with tvOS & OSX
WebDriverAgent 的使用
To get the project set up just run bootstrap script:
./Scripts/bootstrap.sh
It will:
After it is finished you can simply open WebDriverAgent.xcodeproj
and start WebDriverAgentRunner
test and start sending requests.
More about how to start WebDriverAgent here.
官方的文档讲的很清晰,基本没有什么坑。Carthage 是用来解决 xcode project 依赖的,大家可能知道 cocoapod,那你就把 Carthage 理解成和 cocoapod 一样的东西就可以了,可以通过 brew install carthage
安装。npm 是用来构建 Inspector, Inspector 是一个 react 的应用,通过往 WebDriverAgent 发 HTTP 请求,返回页面的结构。
下面是我运行 ./Scripts/bootstrap.sh 的结果:
➜ WebDriverAgent git:(master) ./Scripts/bootstrap.sh
Fetching dependencies
*** Checking out KissXML at "5.0.3"
*** Checking out peertalk at "5a0495a7b7d81b68e25ea1933c755b677cb040da"
*** Checking out RoutingHTTPServer at "v1.0.0"
*** Downloading ocmock.framework binary at "OCMock 3.2.2"
*** Checking out ocmock at "v3.2.2"
*** xcodebuild output can be found in /var/folders/11/wh7ypz2s7q17lxxjphxd4z6h0000gn/T/carthage-xcodebuild.XhkH5T.log
*** Building scheme "OCMock iOS" in OCMock.xcodeproj
2016-05-14 17:45:36.012 xcodebuild[14231:270807] [MT] DVTPlugInManager: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for KSImageNamed.ideplugin (com.ksuther.KSImageNamed) not present
2016-05-14 17:45:36.159 xcodebuild[14231:270807] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-05-14 17:45:36.160 xcodebuild[14231:270807] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library