[iOS]Mocking libraries for XCTest and XCUITest

When you run tests on iOS, you can mock HTTP request with several ways. We can use such mocking for XCUITest as well. For example, you can achieve the way using below libraries. https://github.com/envoy/Embassy https://github.com/envoy/Ambassador https://github.com/KazuCocoa/myCurrencyExchange/blob/master/myCurrencyExchangeUITests/ is the result. If you’d like to achieve similar things based on EarlGrey, you should switch the mocking libraries…More

[iOS][Appium]How to debug, set break points, WebDriverAgent

Debugging WebDriverAgent is tricky. Appium uses the library to run tests against iOS. In this article, I’d like to leave how to debug WebDriverAgent using Appium. You can set break points in arbitrary lines on WebDriverAgent via Xcode following below. On Xcode Clone the repository and finish the setup Open WebDriverAgent.xcodeproj with Xcode Open Edit…More

[iOS]xccov and JSON format

Before Xcode 9.2, we can get formatted coverage data using https://github.com/SlatherOrg/slather, for example. The library formats llvm-cov. But from Xcode 9.3, xccov is introduced officially. The command can run via xcrun. xccov is a new command-line utility for inspecting the contents of Xcode coverage reports. It can be used to view coverage data in both…More

iOS 11 Programmingを今更だけれど読んだ

そういえば、半年以上はもう経ってますよね… 飛行機の待ち時間とかにざっと読んだり、所々、きになるところは写経しながら読んだ。知っているところ、知らないところと様々あったのですが、あの時期にこれだけのものをリリースしたのってやっぱりすごい… 個人的には、Decodable付近の話が一番実際の仕事にも結びつく感じでよかったです。PDFKit付近は、簡単なアプリ作成も兼ねて作ってみようかなと思いました。技術書系も大体はebupで購入してGoogleBooksにあげている生活なのですが、たまにPDFのものを手に入れることもありますし。そんな時に自分で作ったものでサクッと読むとかやっぱり面白いですよね。(そこまで簡単にPDFを組み込める、というところが特に面白かった) iOS 11 Programming 著者:堤 修一,吉田 悠一,池田 翔,坂田 晃一,加藤 尋樹,川邉 雄介,岸川 克己,所 友太,永野 哲久,加藤 寛人, 製本版,電子版 PEAKSで購入する そういえば、Metalもそうだったんだ、確かにというところが多くてとても為になりました。 ありがとうございました。More

[Appium]get performance for iOS

So long ago, I tried to monitor iOS performances using instrument commands. But I gave up once because of host machine’s load. But https://github.com/appium/appium-xcuitest-driver/pull/637 is created and that is awesome… I just remember seeing the PR and I’ve published this article in my memory… https://github.com/appium/appium/pull/10348 https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Recording,Pausing,andStoppingTraces.html#//apple_ref/doc/uid/TP40004652-CH12-SW1More

[iOS]memo for ios-device-control

Around 5 months ago, Google has opensourced ios-device-control to make iOS related work automate. The repository supports both real devices and simulators. https://github.com/google/ios-device-control It provides some examples and [https://github.com/google/ios-device-control/blob/master/java/com/google/iosdevicecontrol/examples/ExampleSimulatorDeviceControl.java] is one example with Simulator. When we run the example, we can see the following outputs. Google has EarlGrey for test automation against UI level and…More

[Swift] Identify not XCTest against XCUITest and EarlGrey

XCTestでは、Swiftの時にAppDelegateを取得しようとするとクラッシュする問題があります。 そのために、 などを使い、XCTestである場合はmockしたAppDelegateを使うなどの対策を行うことがあります。ただ、この場合だと、 XCUITest や EarlGrey によるテストを行うときもこの判定に引っかかります。 以下の差分には、XCUITestとEarlGreyに置ける上記判定を入れています。両方とも同様に判定が行われます。 https://github.com/KazuCocoa/test.examples/commit/cd3ec48b741320071471b27b3ad6254ce4fbacd5 これを避けるために、例えば環境変数でEarlGreyであることを指定する、などが必要。 https://github.com/KazuCocoa/test.examples/commit/aa527223208d4d56260fa0111ccf158554c0d12f プロセスに対する環境変数、iOSのテストだとちょくちょくお世話になることがあると思うので、覚えておくと良さそう。xcodebuildなどに対して環境変数を与えると同じようなことになりますが、これはプロセスに対する環境変数なので注意が必要(プロセス外で定義した環境変数は参照されない) reference https://stackoverflow.com/questions/26946677/uiapplication-sharedapplication-delegate-as-appdelegate-causes-exc-bad-access?answertab=active#tab-top https://stackoverflow.com/questions/39478895/can-you-pass-environment-variables-into-xcodebuild?rq=1 https://stackoverflow.com/questions/27930137/ios-swift-separate-appdelegate-for-xctest/27981726#27981726More