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
0
3k
XCUITestする時のTIPs 〜あなたを助けるXCUITestへ〜
iOS Test Night #4
https://testnight.connpass.com/event/54316/
での発表資料です。
PoohSunny
May 22, 2017
Tweet
Share
More Decks by PoohSunny
See All by PoohSunny
ドレイファスモデルの紹介 / introduce Dreyfus model
poohsunny
1
920
Make Work Visible in Agile2018 #LINE_DM
poohsunny
1
380
タウンワークをドライブさせるためになんちゃってアジャイルをやめた話 #devsumi #devsumiB / devsumi2018
poohsunny
30
45k
1 test 1 assert ?
poohsunny
0
350
XUTPから学ぶ記述性の高いユニットテスト 〜俺たちを助けるユニットテストへ〜 / xUTP in #xpjug
poohsunny
4
5k
コードに思いが伝わる
poohsunny
0
230
横浜タネマキでGebと握手! #yokohamagroovy
poohsunny
0
370
The "yummy" licenses.
poohsunny
0
150
ブラウザテストをサクサク自動化するためのGeb実践入門 #jjug_ccc
poohsunny
21
6.9k
Other Decks in Technology
See All in Technology
Next.js のページ遷移を全力で止める
ypresto
7
3.3k
Cloud Run と GitHub Template Repository による軽量なアプリケーションプラットフォーム/ #nikkei_tech_talk
nikkei_engineer_recruiting
0
110
「認証認可」という体験をデザインする ~Nekko Cloud認証認可基盤計画
logica0419
2
440
たった1人からはじめる【Agile Community of Practice】~ソース原理とFearless Changeを添えて~
ktc_corporate_it
1
480
OSTという文化を組織に根付かせてみた
sansantech
PRO
2
390
『GRANBLUE FANTASY Relink』キャラクターの魅力を支えるリグ・シミュレーション制作事例
cygames
0
120
20240911_New_Relicダッシュボード活用例
speakerdeckfk
0
110
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
46k
Technical Writing Meetup vol.35
soracom
PRO
2
120
アプリをリリースできる状態に保ったまま 段階的にリファクタリングするための 戦略と戦術 / Strategies and tactics for incremental refactoring
yanzm
6
1.4k
グイグイ系QAマネージャーの仕事
sadonosake
0
340
プログラム検証入門
riru
6
870
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
Statistics for Hackers
jakevdp
794
220k
The World Runs on Bad Software
bkeepers
PRO
64
11k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
53
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
3k
What the flash - Photography Introduction
edds
67
11k
Building Adaptive Systems
keathley
36
2.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
From Idea to $5000 a Month in 5 Months
shpigford
379
46k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
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ʙ