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
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
170
生成AIのガバナンスの全体像と現実解
fnifni
1
190
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
100
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
190
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
150
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
150
Storage Browser for Amazon S3
miu_crescent
1
200
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
750
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
podman_update_2024-12
orimanabu
1
280
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
Qiita埋め込み用スライド
naoki_0531
0
5.1k
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
A designer walks into a library…
pauljervisheath
204
24k
Being A Developer After 40
akosma
87
590k
How STYLIGHT went responsive
nonsquared
95
5.2k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Facilitating Awesome Meetings
lara
50
6.1k
Writing Fast Ruby
sferik
628
61k
Unsuck your backbone
ammeep
669
57k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
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ͰಋೖΧδϡΞϧʹ