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
750
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
140
スタートアップの急成長に寄り添うOn-Call体制構築とその変遷
horimislime
3
1.5k
How we build our app with minimum 3rd party dependencies
horimislime
0
82
サポート効率を上げるためのロギング環境構築
horimislime
7
3.8k
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
Other Decks in Technology
See All in Technology
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
330
AIチャットボット開発への生成AI活用
ryomrt
0
170
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
430
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
The Role of Developer Relations in AI Product Success.
giftojabu1
0
140
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
890
Taming you application's environments
salaboy
0
190
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Designing for Performance
lara
604
68k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Designing for humans not robots
tammielis
250
25k
Building Applications with DynamoDB
mza
90
6.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
For a Future-Friendly Web
brad_frost
175
9.4k
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ͰಋೖΧδϡΞϧʹ