[iOS]Bluepill1.0.0

Bluepillの1.0.0がリリースされていたのでメモ。

XCUITestサポートが少し前に完了し、1.0.0になったようですね。

https://github.com/plu/pxctest/releases

こちらに比べて、さすがに企業としての投資が違うのか、開発がBluepillの方が活発だ…

[iOS]run tests on simulators vol2

[iOS]Run multi simulators with FBSimulatorControl
にも書いている、iOSシミュレータを1つのマシンで複数動作させるやつ。最近ではLinkedInからOSSが公開されましたね。Blogはこちら。スターも多く、さすがLinkedInという感じ。

社内で FBSimulatorControl ベースの複数シミュレータで実行する環境を作ろうと思っていたけれど、もっと素晴らしいものが世に出てきててオォォォという感じ…(私、価値出せてない…)
ここら辺、実装能力が顕著に現れて私は本当にまだまだと思う一方です。。。

以下、以前からある類似のものをピックアップ。

類似

これを実施していると、正直なところ並列実行できないCloud実行環境はイマイチですね。
ローカル環境強し。。。

[Design][iOS][Android][windows]

メモ

[ReactNative][Appium]testIDの振られ方

ReactNativeだと、 testID としてiOSだとaccessibilityID、Androidだとview tagを使ってIDを埋め込むのですね。なので、ReactNativeのアプリに対してidで要素を検索したい場合はAndroidだと特に従来のAppiumやEspressoとは少し異なる。

Appiumだと、以下でview tagの取得をサポートするらしい。

これつくと、resource idが同じ要素も細かくidを振って操作することもできるようになるので、安定性向上に寄与しそうですね。

Does EarlGrey support finding react-native elements?
https://github.com/google/EarlGrey/blob/master/docs/faq.md

react native

[iOS]Run multi simulators with FBSimulatorControl

複数のシミュレータを1つの端末/OS上で起動可能な FBSimulatorControl はご存知の方も多いかもしれません。
それを使った時のメモ。最後の方に、XCTestを実行する時のものも。

installはリポジトリを参考に。
(以下は 0.2.0 のバージョン)

  • listを表示
$ fbsimctl list
05AB6F68-813D-4C6C-A95E-F77CC00D2DDA | Apple TV 1080p | Shutdown | Apple TV 1080p | tvOS 10.0
A1C5C8BF-DB4E-4649-B29E-E8B2FB9351B9 | iPad Retina | Shutdown | iPad Retina | iOS 10.0
1E4AE723-317F-4598-9CB8-0C92825FDC41 | iPad Pro (9.7 inch) | Shutdown | iPad Pro (9.7-inch) | iOS 10.0
F3DEEDB4-3CC0-46F3-90EB-E01C8955D1CD | iPad Pro (12.9 inch) | Shutdown | iPad Pro (12.9-inch) | iOS 10.0
A7EEA0FE-36B3-40A3-AE67-41E3324B4B7E | iPad Air 2 | Shutdown | iPad Air 2 | iOS 10.0
98A63C99-B352-4039-8D3D-3F3393387BC0 | iPad Air | Shutdown | iPad Air | iOS 10.0
56CEEBD7-DF37-4E17-AD7C-B42BD4A2C6E5 | iPhone SE | Shutdown | iPhone SE | iOS 10.0
0180EE6C-4749-4127-A983-B190856C3D29 | iPhone 7 Plus | Shutdown | iPhone 7 Plus | iOS 10.0
B5A0DFCE-C33A-4362-9109-EA19530FC7BF | iPhone 7 | Shutdown | iPhone 7 | iOS 10.0
E3B28E7A-E7DB-469F-B41C-1244C7718A1C | iPhone 6s Plus | Shutdown | iPhone 6s Plus | iOS 10.0
6D533AC6-94AF-4EC1-BA69-9EF73E6C9A38 | iPhone 6s | Shutdown | iPhone 6s | iOS 10.0
ED558E83-9DFE-4027-8108-6173EE518F9F | iPhone 6 Plus | Shutdown | iPhone 6 Plus | iOS 10.0
C523040C-CDCF-42FD-864C-26DE36A2424F | iPhone 6 | Shutdown | iPhone 6 | iOS 10.0
12995D09-DC3F-4921-8CF4-4931A59A40D0 | iPhone 5s | Shutdown | iPhone 5s | iOS 10.0
EA829C44-9313-45A4-9770-A0B8BD15967C | iPhone 5 | Shutdown | iPhone 5 | iOS 10.0
E27018D9-5783-4A85-8112-0B85EF2C9AD5 | Apple Watch Series 2 - 42mm | Shutdown | Apple Watch Series 2 - 42mm | watchOS 3.0
EB98AC75-E4F4-4B66-B57F-0B8CE18A6221 | Apple Watch Series 2 - 38mm | Shutdown | Apple Watch Series 2 - 38mm | watchOS 3.0
2405DF4B-31BC-4E50-98EA-B9DBC00A8B5D | Apple Watch - 42mm | Shutdown | Apple Watch - 42mm | watchOS 3.0
91B32C5D-DBD4-4477-BF18-94747EC77C65 | Apple Watch - 38mm | Shutdown | Apple Watch - 38mm | watchOS 3.0
  • 2つの端末を同時起動
$ fbsimctl 12995D09-DC3F-4921-8CF4-4931A59A40D0 0180EE6C-4749-4127-A983-B190856C3D29 boot
Container Application Did Launch => Process Simulator | PID 28616
0180EE6C-4749-4127-A983-B190856C3D29 | iPhone 7 Plus | Shutdown | iPhone 7 Plus | iOS 10.0: launch: Process Simulator | PID 28616
Did Change State => Booting
0180EE6C-4749-4127-A983-B190856C3D29 | iPhone 7 Plus | Booting | iPhone 7 Plus | iOS 10.0: state: Booting
Simulator Did launch => Process launchd_sim | PID 28618
0180EE6C-4749-4127-A983-B190856C3D29 | iPhone 7 Plus | Booted | iPhone 7 Plus | iOS 10.0: launch: Process launchd_sim | PID 28618
Did Change State => Booted
0180EE6C-4749-4127-A983-B190856C3D29 | iPhone 7 Plus | Booted | iPhone 7 Plus | iOS 10.0: state: Booted
Connection Did Connect => Bridge: Framebuffer ((null)) | HID (null) | (null)
0180EE6C-4749-4127-A983-B190856C3D29 | iPhone 7 Plus | Booted | iPhone 7 Plus | iOS 10.0: launch: Bridge: Framebuffer ((null)) | HID (null) | (null)
Container Application Did Launch => Process Simulator | PID 28647
12995D09-DC3F-4921-8CF4-4931A59A40D0 | iPhone 5s | Shutdown | iPhone 5s | iOS 10.0: launch: Process Simulator | PID 28647
Did Change State => Booting
12995D09-DC3F-4921-8CF4-4931A59A40D0 | iPhone 5s | Booting | iPhone 5s | iOS 10.0: state: Booting
Simulator Did launch => Process launchd_sim | PID 28649
12995D09-DC3F-4921-8CF4-4931A59A40D0 | iPhone 5s | Booted | iPhone 5s | iOS 10.0: launch: Process launchd_sim | PID 28649
Did Change State => Booted
12995D09-DC3F-4921-8CF4-4931A59A40D0 | iPhone 5s | Booted | iPhone 5s | iOS 10.0: state: Booted
Connection Did Connect => Bridge: Framebuffer ((null)) | HID (null) | (null)
12995D09-DC3F-4921-8CF4-4931A59A40D0 | iPhone 5s | Booted | iPhone 5s | iOS 10.0: launch: Bridge: Framebuffer ((null)) | HID (null) | (null)
Scale (null) | No Locale Override | Options [] | No Framebuffer
Scale (null) | No Locale Override | Options [] | No Framebuffer
  • help
$ fbsimctl help
[fbsimctl] Help
===============

    fbsimctl {{ [output] | [management] | --set <directory> }}* [targets]? [target-format]* {{ [action] ... -- [action] }}+
OR  fbsimctl [output]* help

fbsimclt is a Mac OS X library for managing and manipulating iOS Simulators

    --set


[action] Action
===============

    [approve]
OR  [boot]
OR  [clear_keychain]
OR  config
OR  [create]
OR  delete
OR  [diagnose]
OR  erase
OR  install <string>
OR  [launch(agent)]
OR  [launch(app)]
OR  [launch_xctest]
OR  [listen]
OR  list
OR  list_apps
OR  list_device_sets
OR  open <url>
OR  record {{ start | stop }}
OR  [relaunch]
OR  shutdown
OR  tap <double> <double>
OR  terminate {{ <application> | <bundle-id> }}
OR  uninstall {{ <application> | <bundle-id> }}
OR  upload <file>+
OR  [watchdog_override]
OR  set_location <double> <double>


[approve] Action: Approve
=========================

    approve {{ <application> | <bundle-id> }}+


[boot] Action: Boot
===================

    boot {{ --connect-bridge | --direct-launch | --use-nsworkspace | --scale=25 | --scale=50 | --scale=75 | --scale=100 | --locale <locale> }}*

    --connect-bridge
    --direct-launch
    --locale
    --scale=100
    --scale=25
    --scale=50
    --scale=75
    --use-nsworkspace


[clear_keychain] Action: Clear Keychain
=======================================

    clear_keychain {{ <application> | <bundle-id> }}?


[create] Action: Create
=======================

    create {{ --all-missing-defaults | {{ <device-name> | <os-version> | --aux <directory> }}* }}

    --all-missing-defaults
    --aux


[diagnose] Action: Diagnose
===========================

    diagnose {{ --current-format | --path | --content }} [diagnose/query]

    --content
    --current-format
    --path


[diagnose/query] Diagnose: Query
================================

    {{ <application> | <bundle-id> }} <string>+
OR  {{ --name <string> }}+
OR  --crashes-since <date> {{ --application | --system | --custom-agent }}*

    --application
    --crashes-since
    --custom-agent
    --name
    --system


[launch(agent)] Action: Launch (Agent)
======================================

    launch {{ --stdout | --stderr }}* <binary> <string>* --?

    --stderr
    --stdout


[launch(app)] Action: Launch (App)
==================================

    launch {{ --stdout | --stderr }}* {{ <application> | <bundle-id> }} <string>* --?

    --stderr
    --stdout


[launch_xctest] Action: Launch XCTest
=====================================

    launch_xctest {{ --test-timeout <double> }}? <directory> {{ --stdout | --stderr }}* {{ <application> | <bundle-id> }} <string>* --?

    --stderr
    --stdout
    --test-timeout


[listen] Action: Listen
=======================

    listen {{ --socket <port> | --http <port> }}

    --http
    --socket


[management] Simulator Management
=================================

    --delete-all | --kill-all | --kill-spurious | --ignore-spurious-kill-fail | --kill-spurious-services | --timeout-resiliance

    --delete-all
    --ignore-spurious-kill-fail
    --kill-all
    --kill-spurious
    --kill-spurious-services
    --timeout-resiliance


[output] Output Options
=======================

    --debug-logging | --json | --pretty

    --debug-logging
    --json
    --pretty


[relaunch] Action: Relaunch
===========================

    relaunch {{ --stdout | --stderr }}* {{ <application> | <bundle-id> }} <string>* --?

    --stderr
    --stdout


[target-format] Target Format
=============================

    --udid | --name | --device-name | --os | --state | --pid | --container_pid


[targets] Targets
=================

    all | [targets/query]+


[targets/query] Target: Queries
===============================

    --first <int> | <udid> | --state=creating | --state=shutdown | --state=booting | --state=booted | --state=shutting-down | --simulators | --devices | <os-version> | <device-name>

    --devices
    --first
    --simulators
    --state=booted
    --state=booting
    --state=creating
    --state=shutdown
    --state=shutting-down


[watchdog_override] Action: Watchdog Override
=============================================

    watchdog_override <double> {{ <application> | <bundle-id> }}+


Primitives:

    <application>             Path to an application.
    <binary>                  Path to a binary.
    <bundle-id>               Bundle ID.
    <date>                    Time since UNIX epoch (seconds)
    <device-name>             Device Name.
    <directory>               Path to a directory.
    <double>                  Double-precision floating point number.
    <file>                    Path to a file.
    <int>                     Signed integer.
    <locale>                  Locale identifier.
    <os-version>              OS Version.
    <port>                    Port number (16-bit unsigned integer).
    <string>                  String without spaces.
    <udid>                    Device or simulator Unique Device Identifier.
    <url>                     URL.

以下のPR/議論で、結果の出力フォーマットとしてJUnitなんかを選択できるようになったようです。

また、以下の通り .xctest を対象にすると、XCTestを実行可能なようです。

fbsimctl --state=booted \
launch_xctest /path/to/WebDriverAgentRunner.xctest com.apple.mobilesafari --port 8100 -- \
listen

という形でテストを実行できる模様。
.xctest はAWS Device Farmとかでも使えるコレですね。

http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-ios-xctest.html

Appium1.6.0 released !!

https://github.com/appium/appium/releases/tag/v1.6.0

  • support XCUITest(WebDriverAgent) to test against Xcode8 x above iOS9.3
    • BTW, this feature has some unstable/known issues
  • support UI Automator 2 for Android

I already tried previous its beta version in my company, and then I issued some problems to Appium and it already fixed. I’ll switch to this new version from previous 1.5 in the near future 🙂

In addition, EarlGrey 1.4.0 also released!

minimal ruby client for WebDriverAgent

WebDriverAgent developed by Facebook is one of WebDriver tool which run on iOS.

Previous some posts, I investigated this module. And now, I develop minimal wrapper Ruby cli client to help some operations.

I implemented some operations such as taking screenshots, getting source tree, status about the driver and install arbitrary app to the launched iOS target and get its session id. This minimal library will support some tasks for handling iOS applications.

This library does’t have concrete plan to develop as testing library for WebDriver for now. Just helping some operations against WebDriverAgent.

If you’d like to run tests via WebDriverAgent, please use Appium and it’s ruby binding. Because Appium will support WebDriverAgent in the future. (https://github.com/appium/appium-xcuitest-driver)

some references