man safaridriver provides us what feature we can get by the command. Below is a note what capabilities are available for us. (Please ensure what capabilities etc are available on your target platform before using them.) My environment was macOS 10.14.6. Session Creation browserName, browserVersion, platformName, safari:platformVersion, safari:platformBuildVersion, safari:useSimulator, safari:deviceType, safari:deviceName, safari:deviceUDID Other safari:automaticInspection, safari:automaticProfiling,…More
Author Archives: KazuCocoa
Appium/XCTest(UI)の実行性能差
この記事は「Selenium/Appium Advent Calendar 2019」1日目の記事です。今回は、Appiumの開発をしている中で問題の報告が多かったXcode 11、iOS 13における実行性能の劣化問題を調べていた時に知ったことです。内容はこのissueの一部です。 Appiumの実行形態とその実行性能 Appiumは基本的には中間サーバとしてテストケースとテスト対象の操作を仲介します。 ある利用者がテストケースを特定の開発言語なりで記述、実行するとします。そのテストケース実行系の中でAppiumサーバに対してHTTPリクエストを送出し、リクエストを受け取ったAppiumサーバーは自身が管理する実行端末上で動作するサーバーに対して操作を要求したり、自身で端末を直接操作します。その操作結果をテストケース実行系に対して返信します。この一連の流れが1つのセットとなり、Appiumのもつ個々の操作が行われます。 つまり、1つのAppiumのコマンド実行時間には、HTTP通信の往復時間が必ずオーバーヘッドとして存在することになります。実行系全体が同一端末に存在する場合、その時間はごく僅かであることが多いです。一方、物理的に異なる環境でテストケースの実行元と実行環境が離れている場合、そのHTTPリクエストにかかる時間は秒単位で大きくなる可能性もあります。(AppiumProにある例) iOSの実行系とXcode 11の変化 現在、AppiumにおけるiOSのテストとしてXCUITest Driverと表現する実行系があります。Appiumは中間サーバとして機能すると先ほど述べました。つまり、Appium自体はその実行端末を操作する側の実装があれば、様々な端末を対象に同様のコマンド実行を実現できます。iOSではXCUITest Driverが、AndroidではUIAutomator2やEspresso Driver、WindowではWinAppDriverなど存在します。 この中で、今回の話題の対象はXCUITest Driverです。この仕組みとして、WebDriverAgentと呼ぶAppleが提供するXCTest(UI)や周辺APIをラップする、iOS端末上で動作するサーバがあります。AppiumサーバはこのWebDriverAgentと独自のiOS端末との直接操作する手段を介してテスト対象となるアプリなどを操作します。 WebDriverAgentはXcode 9の頃から同様の機能を実現していました。Xcodeも11となり、XCTestが提供するUIテストむけ機能も安定、拡充してきました。古いXCTest(UI)などが提供するプライベートAPIもDeprecatedになり、Xcode 11ではXCTest(UI)が内部で利用しているであろうメソッドを利用することにしました。 Xcode 11とiOS 13環境下ではiOS 12環境では問題ない操作が遅くなるなどの報告が出るようになりました。この問題が性能計測の発端です。目的としては、Appiumが利用しているメソッドが問題なのか、XCTest(UI)自体がXcode 11とiOS 13環境において問題を抱えているかでした。 AppiumとXCTest(UI)との実行差分 原理的には、XCUITest DriverとXCTest(UI)は、実際にアプリを操作するためのメソッドは同一です(であるはず)。となると、その実行時間の差分は、AppiumがHTTPリクエストを介するぶんだけ遅延することが常であるはずです。 先に計測結果だけ述べます。 Xcode 11環境下において、iOS 13を対象にするとほぼ期待通りの結果であるいっぽう、iOS 12を対象とするとAppiumの方が高速であることがわかりました。少し前に記述した「Xcode 11ではXCTest(UI)が内部で利用しているであろうメソッドを利用することにしました。」と説明した箇所のメソッドの利用は、内部的には、selectorと呼ばれるあるメソッドが存在するとそれを利用するというロジックを利用しています。そのメソッドは実際にはXcode 9以降に存在するものであるため、実質的にはAppiumはiOS 12、13問わずそのメソッドを利用します。iOS 13の実行性能がAppiumとXCTest(UI)では大差ないこと、XTest(UI)はiOS 12と13では実行性能はほぼ同一なので、XCTest(UI)はiOS 12、13に関わらず同一のメソッドを経由して要素検索などを実行している可能性が高いです。 と考えると、AppiumのiOS 12以下に対する操作がiOS 13はもとより、XCTest(UI)より高速であることは驚きです。内部実装の詳細は知るすべがないのでこれ以上の言及はできませんが、iOS 13は実行性能がiOS 12よりは劣化している面はありつつも、AppiumのHTTPリクエストを除く実行遅延はXCTest(UI)とほぼ同様であることがわかります。Appiumが遅かった場合、XCTest(UI)でも遅い可能性があり、Appleさんの改善に期待したいところで。 計測値 ともあれ、行なった計測を提示します。 テスト対象 テスト対象は、新規作成したプロジェクトにButton要素を付与しただけのアプリです。至極単純なアプリです。 Appium 1.16-beta Xcode 11.2.1 Swift…More
Learned “The Oxford Guide to Effective Writing and Speaking”
Read and learned English basic stuff by The Oxford Guide to Effective Writing and Speaking. I’m an English learner as a second language to improve my english skills. Recent my life and work are close to English world, so I have been learned English stuff via various ways. This book is one of them. The…More
[Appium][Android] background process restrictions
We recently got an issue about stopping background process, uiautomator2-server. I knew several limitations/restrictions for such background process on newer Android versions, but we had not got general issues by such features so far. The VIVO devices have customised OS based on Android OS. So, definitely, we can say the series is Android, but not…More
Read “The form of knowledge” ~ ちのかたち
ちのかたち 建築的思考のプロトタイプとその応用. “The Form of Knowledge – The Prototype of Architectural Thinking and Its Application” is the English title. All of description in the book were written in both Japanese and English. It describes various projects about architecture such as housings and buildings. It shown various theme, process stuff like super liner process but they…More
Read “n月刊ラムダノート Vol.1, No.3(2019)”
Read “n月刊ラムダノート Vol.1, No.3(2019)” which was about pattern matching. The series focus on various topics about computers. The third was “pattern matching”. (My experience for the pattern match is based on Erlang/Elixir.) The 1st section was how it works in general, and the 2nd one was Ruby 2.7 since Ruby 2.7 will get the feature.…More
Read “An Elegant Puzzle: Systems of Engineering Management”
An Elegant Puzzle: Systems of Engineering Management was a very insightful book for building organisation/teams. I haven’t experienced such rapid scaled organisation/team, but I experienced to manage team, departments before. Thus, some of them were easy to imagine. Such topic is also well discussed in Test/QA/Agile industry, I think. Especially, “Organizational design gets the right…More
[iOS][XCTest][Appium]Slow type speed in iOS 13 under XCUIElementTypeWebView elements inside UIWebView
I found slow send keys happened on XCTest framework layer. https://github.com/appium/appium/issues/13455#issuecomment-544072750 It took 5 sec every key type. It happened only elements under XCUIElementTypeWebView type. This happened only on iOS 13. Quick workaround is typing keyboard directly. It means find keys by find element and tap it one by one. Then, it has no such…More
[Appium][iOS]handle dark mode via process arguments
Appium’s appium-ios-simulator has an ability to make simulator instance dark mode by issue. The ability affects entire system, but it works only on Simulator. We can handle the style in real devices, too, when the app has a logic to switch it in the code level. We also can control the configuration via process arguments…More
[Appium][iOS] Automate split screen by iPad OS
iPad OS has been released. On the OS, we can use split screen feature to handle multiple apps on the screen. In this case, there are multiple active apps on the screen. Appium 1.15.0 has defaultActiveApplication settings API to handle such case. You can handle on of them specifying the app as defaultActiveApplication. Below is…More