Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UI testing in XCode7
Search
horimislime
June 30, 2015
Technology
3
760
UI testing in XCode7
horimislime
June 30, 2015
Tweet
Share
More Decks by horimislime
See All by horimislime
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
170
スタートアップの急成長に寄り添うOn-Call体制構築とその変遷
horimislime
3
1.6k
How we build our app with minimum 3rd party dependencies
horimislime
0
85
サポート効率を上げるためのロギング環境構築
horimislime
7
3.8k
migrating-from-promise-to-reactive
horimislime
0
360
社内Swiftもくもく会成果発表
horimislime
0
120
Swift Optional Extension Tips
horimislime
1
1.5k
ios-internationalization
horimislime
2
8.8k
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2.3k
Other Decks in Technology
See All in Technology
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
190
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1k
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
生成AIのガバナンスの全体像と現実解
fnifni
1
180
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
540
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
530
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
It's Worth the Effort
3n
183
28k
Building an army of robots
kneath
302
44k
BBQ
matthewcrist
85
9.4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
A better future with KSS
kneath
238
17k
Optimising Largest Contentful Paint
csswizardry
33
3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Transcript
✔ UI Testing in XCode7 Google I/O & WWDCใࠂձ@Fablic @horimislime
ࣗݾհ & ͢͜ͱ • ɹ @horimislime • ɹ גࣜձࣾτϨλ •
XCode7ͰՃ͞ΕͨUI TestingͷͰ͢
None
ͬͯΔ͜ͱ • BtoBࣄۀɻக໋తόά ≒ ܖղফ • ςετΖ͏ → KIFಋೖ (WWDCલ)
• UI Testingొ
UI TestingͰԿ͕มΘΔ͔ʁ • جຊతʹKIFͱࣅ͍ͯΔ • γϯϓϧͳAPIɻᙱ͍ͱ͜Ζʹख͕ಧ͖ͦ͏ • UI RecordingɾScreenShotͷࣗಈࡱӨ
func testReserve() { // tester.tapViewWithAccessibilityLabel("৽ن༧") XCUIApplication().buttons["৽ن༧"].tap() }
ίʔυ”جຊ”खॻ͖ෆཁ • UI RecordingͰSimulatorૢ࡞ɾίʔυੜ • ViewͷAccessibilityLabelࢦఆ͕”΄΅”ෆཁ
ίʔυ”جຊ”खॻ͖ෆཁ • UI RecordingͰSimulatorૢ࡞ɾίʔυੜ • ViewͷAccessibilityLabelࢦఆ͕”΄΅”ෆཁ
͋͘·Ͱɺجຊతʹ • AccessibilityLabelͷઃఆਪ͞ΕͯΔ • Label͕ແ͍ͱݫ͍͠έʔε XCUIApplication().childrenMatchingType(.Window).elementAtIndex(0) .childrenMatchingType(.Unknown).elementAtIndex(0) .childrenMatchingType(.Unknown).elementAtIndex(0) .childrenMatchingType(.Unknown).elementAtIndex(0) .childrenMatchingType(.Unknown).elementAtIndex(0)
.childrenMatchingType(.Unknown).elementAtIndex(1) .childrenMatchingType(.Unknown).elementAtIndex(0) .childrenMatchingType(.Button).elementAtIndex(0).tap()
ScreenShotͷࣗಈࡱӨ • tap()ͳͲUIૢ࡞લʹը໘ΛࡱӨͯ͘͠ΕΔ
xcodebuildͰ $ xcodebuild -workspace Toreta.xcworkspace -scheme "Toreta UI
Tests" -destination 'platform=iOS Simulator,name=iPad Air 2,OS=9.0' -derivedDataPath './output' test
ίʔυ্ͰࡱӨ͏ཁΒͳ͍ʁ • Snapshot TestingΈ͍ͨͳࣄ͚ͨ͠Εݫ͍͠ • ը૾ϑΝΠϧ໊ͷࢦఆ͕Ͱ͖ͳ͍… • ςετຖʹը໘ͷࡱӨ͍͚ͨͩ͠ͳΒ
ݸਓతʹخ͍͠ͱ͜Ζ • Simulatorͷىಈɾఀࢭ͕ίʔυ্ͰՄೳʹ • ࠔͬͯͨ͜ͱ - TOPը໘ˠઃఆը໘ͷભҠΛςετ - TOPը໘ˠ͓Βͤը໘ͷભҠΛςετ •
ςετ։࢝࣌ΞϓϦىಈޙͷঢ়ଶʹ
override func setUp() { … XCUIApplication().launch() } override func tearDown()
{ … XCUIApplication().terminate() }
Simulator੍ޚ͕ॊೈʹ • ςετ։࢝࣌ΞϓϦ্ཱͪ͛ͨޙͷঢ়ଶ • tearDown()ͰTOPΔॲཧ͕ෆཁʹ • Simulatorͷىಈ݅ࢦఆՄೳ
override func setUp() { super.setUp() let app = XCUIApplication() app.launch()
}
override func setUp() { super.setUp() let app = XCUIApplication() app.launchArguments
+= ["-AppleLanguages (English)"] app.launch() }
͜ΕΒΛ౿·͑ͯ • ৽نͰॻ͘UI Testʹ͍͍͔ͬͯ • ෳݴޠͰͷςετAccessibilityLabelඞਢ - XCUIApplication().buttons[“ઃఆ”].tap() // Fail!!
• KIFͰॻ͍ͨςετίʔυɺϓϥΠεϨε
·ͱΊ • XCode7͔ΒUIͷࣗಈςετ͕ڧԽ • FluentͳAPIɺSimulatorॊೈʹૢ࡞Մ • UI RecordingͰಋೖΧδϡΞϧʹ