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
740
UI testing in XCode7
horimislime
June 30, 2015
Tweet
Share
More Decks by horimislime
See All by horimislime
スタートアップの急成長に寄り添うOn-Call体制構築とその変遷
horimislime
3
1.4k
How we build our app with minimum 3rd party dependencies
horimislime
0
78
サポート効率を上げるためのロギング環境構築
horimislime
7
3.7k
migrating-from-promise-to-reactive
horimislime
0
360
社内Swiftもくもく会成果発表
horimislime
0
110
Swift Optional Extension Tips
horimislime
1
1.4k
ios-internationalization
horimislime
2
8.8k
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2.3k
Swift Libraryざっくり現状確認 / Swift library overview
horimislime
1
130
Other Decks in Technology
See All in Technology
Unlearn Modularity
lemiorhan
6
180
Binary Hacks Rebooted 私選ハック集
nullpo_head
1
300
LeSSはスクラムではない!?LeSSにおけるスクラムマスターの振る舞い方とは / Scrum Master Behavior in LeSS
toma_sm
0
210
OPENLOGI Company Profile
hr01
0
54k
Databricks Appのご紹介
databricksjapan
0
370
テストコードの品質を客観的な数値で担保しよう〜Mutation Testのすすめ〜
ysknsid25
12
3.6k
LINE-ChatGPT 倫理問題を整理する全力肯定彼氏くん [LuC4]に訪れたサービス開始以来の最大の危機
o_ob
2
160
YAPC::Hakodateの映像記録を支える技術
godan
4
380
Case Study: Concurrent Counting
ennael
PRO
0
130
Semantic Kernel の Agent 機能試してみた!
okazuki
1
170
業務ヒアリングと知識の呪い
tamai_63
0
290
New Relicを活用したシステム監視の強化とオブザーバビリティ向上
sugoto911
1
110
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
119
11k
RailsConf 2023
tenderlove
28
850
What's in a price? How to price your products and services
michaelherold
243
11k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
4
120
The Pragmatic Product Professional
lauravandoore
31
6.2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
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ͰಋೖΧδϡΞϧʹ