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
いざ、BSC討伐の旅
nikinusu
2
780
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
380
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
190
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
120
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
510
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
Terraform Stacks入門 #HashiTalks
msato
0
350
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
DMARC 対応の話 - MIXI CTO オフィスアワー #04
bbqallstars
1
160
Lambdaと地方とコミュニティ
miu_crescent
2
370
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
330
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.3k
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
50
7.2k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
The World Runs on Bad Software
bkeepers
PRO
65
11k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Speed Design
sergeychernyshev
24
610
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
GitHub's CSS Performance
jonrohan
1030
460k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
RailsConf 2023
tenderlove
29
900
Art, The Web, and Tiny UX
lynnandtonic
297
20k
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ͰಋೖΧδϡΞϧʹ