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
XCUITestする時のTIPs 〜あなたを助けるXCUITestへ〜
Search
PoohSunny
May 22, 2017
Technology
3.2k
0
Share
XCUITestする時のTIPs 〜あなたを助けるXCUITestへ〜
iOS Test Night #4
https://testnight.connpass.com/event/54316/
での発表資料です。
PoohSunny
May 22, 2017
More Decks by PoohSunny
See All by PoohSunny
ドレイファスモデルの紹介 / introduce Dreyfus model
poohsunny
1
1.6k
Make Work Visible in Agile2018 #LINE_DM
poohsunny
1
480
タウンワークをドライブさせるためになんちゃってアジャイルをやめた話 #devsumi #devsumiB / devsumi2018
poohsunny
30
47k
1 test 1 assert ?
poohsunny
0
490
XUTPから学ぶ記述性の高いユニットテスト 〜俺たちを助けるユニットテストへ〜 / xUTP in #xpjug
poohsunny
4
5.4k
コードに思いが伝わる
poohsunny
0
360
横浜タネマキでGebと握手! #yokohamagroovy
poohsunny
0
440
The "yummy" licenses.
poohsunny
0
240
ブラウザテストをサクサク自動化するためのGeb実践入門 #jjug_ccc
poohsunny
21
7.2k
Other Decks in Technology
See All in Technology
ポスター発表&デモと総括 / Poster Presentations & Demonstrations and Summary
ks91
PRO
0
190
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.9k
ポケモンの型をTypeScriptの型システムで表現してみた
subroh0508
0
200
Strands Agents超入門
kintotechdev
1
160
[モダンアプリ勉強会]今更聞けないGit/GitHub入門
tsukuboshi
0
200
【Gen-AX】20260530開催_JJUG CCC 2026 Spring
genax
0
400
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
50k
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
4
1.8k
Javaで学ぶSOLID原則
negima
1
270
Platform Engineering as a Product: Criteria for Improvement and Multi-Tenant Design
kumorn5s
0
490
「気づいたら仕事が終わっている」バクラクAIエージェント本番運用の裏側 / layerx-bakuraku-aie2026
yuya4
18
9.1k
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
340
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
300
Skip the Path - Find Your Career Trail
mkilby
1
140
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
310
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
230
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
74k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Paper Plane (Part 1)
katiecoart
PRO
0
8.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Transcript
XCUITest͢Δ࣌ͷ TIPs ʙ͋ͳͨΛॿ͚ΔXCUITestʙ @PoohSunny iOS Test Night #4
@PoohSunny { work: "σΟϕϩούʔ", company: "ϦΫϧʔτδϣϒζ", lang: ["Swift", "Java", "Groovy"],
community: [ "TDDBC", "Agile Samurai Base Camp", "ຊSeleniumϢʔβʔίϛϡχςΟ" ] }
Selenium͖1 1 ग़ॴɿٕज़ධࣾ
iOSॳΊͯ̍ ʢποίϛܴʂʣ
ΑΖ͘͠ ͓ئ͍͠·͢
UITestͷ
None
XCUITest ͍ͬͯ·͢
TIPsͷհ ଞͷςετϑϨʔϜϫʔΫͰ͑Δͣʂ
TIP1 Ͳ͜·Ͱςετ͢Ε͍͍Μ ͩorz
εϞʔΫςετ
1. جຊతͳಈઢ 2. མͪΔͱॏେো ʹͳΔ෦
TIP2 UIΛมߋͨ͠Βͨ͘͞Μͷς ετ͕͚ͯ͜͠·ͬͨorz
ϖʔδΦϒδΣΫτύλʔϯ Λར༻ͨ͠มߋͷہॴԽ ςετରͷϖʔδΛΦϒδΣΫτͱͯ͠ςετ ͔ΒΓ͠ɺϝϯςφϯεੑΛߴΊΔ2 2 http://www.seleniumhq.org/docs/06testdesign_considerations.jsp#page-object-design-pattern
ཁ3 • publicϝιου->ϖʔδ͕ఏڙ͢ΔαʔϏεΛ දݱ • ϖʔδͷ෦Λ࿐ग़͠ͳ͍Α͏ʹ͠·͢ • ҰൠతʹɺΞαʔγϣϯߦ͍·ͤΜ • ϝιουผͷPageObjectsΛฦ͠·͢
3 http://garbagetown.hatenablog.com/entry/2013/11/07/075011͔ΒҾ༻
σΟϨΫτϦ UITest |-- Module // ֤ϖʔδͰڞ௨͢Δ෦܈ |-- Screen // ϖʔδΦϒδΣΫτ
`-- Test // ࣮ࡍͷςετέʔε
αϯϓϧ class TopScreen: BaseScreen { required init(xcuiApplication: XCUIApplication) { super.init(xcuiApplication:
xcuiApplication) XCTAssert(app.navigationBars["τοϓ"].exists) } func ݕࡧϘλϯΛԡ͢() -> BaseScreen { app.navigationBars.buttons.elementBoundByIndex(0).tap() return ResultScreen(xcuiApplication: xcuiApplication) } }
TIP3 ͜ͷςετԿͯ͠Δͷ͔Θ͔ ΜͶʔorz
ςετͷՄಡੑΛ্͛Δ ྫ͑ར༻ϝιου໊Λຊޠʹ͢Δ func testۈΛબ͢Δ() { let τοϓϖʔδ = TopScreen(xcuiApplication: XCUIApplication())
τοϓϖʔδ.ಓݝΛબ͢Δ(Area.౦ژ) let ݕࡧ݁Ռϖʔδ = τοϓϖʔδ.ݕࡧ͢Δ() XCTAssert(ݕࡧ݁Ռϖʔδ.දࣔ͞Ε͍ͯΔ()) }
ϖʔδΦϒδΣΫτΛ ࡞ΓࠐΉ func testۈΛબ͢Δ() { let τοϓϖʔδ = TopScreen(xcuiApplication: XCUIApplication())
let ݕࡧ݁Ռϖʔδ = τοϓϖʔδ.Լه݅Ͱݕࡧ͢Δ(Area.౦ژ, "ϑϦʔϫʔυ") XCTAssert(ݕࡧ݁Ռϖʔδ.දࣔ͞Ε͍ͯΔ()) }
Given-When-Thenҙࣝͯ͠ ΈΔ func testۈΛબ͢Δ() { // given let τοϓϖʔδ =
TopScreen(xcuiApplication: XCUIApplication()) // when let ݕࡧ݁Ռϖʔδ = τοϓϖʔδ.Լه݅Ͱݕࡧ͢Δ(Area.౦ژ, "ϑϦʔϫʔυ") // then XCTAssert(ݕࡧ݁Ռϖʔδ.දࣔ͞Ε͍ͯΔ()) }
4 phase test4Ͱ Setup - Exercise - Verify - Teardown
3A5Ͱ Arrange - Act - Assert 5 http://xp123.com/articles/3a-arrange-act-assert/ 4 http://xunitpatterns.com/Four%20Phase%20Test.html
·ͱΊ • TIP1. Ͳ͜·Ͱςετ͢Δ͔໎ͬͨΒεϞʔΫ ςετ • TIP2. มߋΛہॴԽ͍ͨ͠ͳΒϖʔδΦϒδΣ Ϋτύλʔϯ •
TIP3. ՄಡੑΛ্͍͛ͨͳΒຊޠΛ͏ͷΛ ԀΘͳ͍
͓͠·͍ ʙ͋ͳͨΛॿ͚ΔXCUITestʙ