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
開発を効率化するテストのデザインパターン
Search
Kuniwak
PRO
March 13, 2017
Programming
37
12k
開発を効率化するテストのデザインパターン
2017/3/13 iOS Test Night #3
https://testnight.connpass.com/event/49561/
Kuniwak
PRO
March 13, 2017
Tweet
Share
More Decks by Kuniwak
See All by Kuniwak
欠陥を早期に発見するための Software Engineer in Test とその重要性 / What is Software Engineer in Test and How they works
orgachem
PRO
21
3.9k
住宅を WebXR で評価しよう / Evaluating My Home by WebXR
orgachem
PRO
0
73
HOME VR
orgachem
PRO
1
790
uGUI の自動操作の考え方と操作方法
orgachem
PRO
1
1.3k
Swift Macro に備えて構文木を 10min で学ぶ / Learn Syntax Tree for Swift Macro in 10 minutes
orgachem
PRO
1
1.1k
SoftWare Engineer in Test のおしごと / What is SWET
orgachem
PRO
1
1k
私と Nature Remo E / Nature Remo E
orgachem
PRO
0
25k
存在しないアセットへの参照と 未公開アセットでのネタバレに どう立ち向かうか / How to prevent missing assets and spoilers by assets
orgachem
PRO
1
1k
睡眠する技術 / Technology to Sleep
orgachem
PRO
15
14k
Other Decks in Programming
See All in Programming
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
910
CSC509 Lecture 12
javiergs
PRO
0
160
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Jakarta EE meets AI
ivargrimstad
0
610
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
170
Realtime API 入門
riofujimon
0
150
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
GitHub's CSS Performance
jonrohan
1030
460k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
A Philosophy of Restraint
colly
203
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Done Done
chrislema
181
16k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
What's in a price? How to price your products and services
michaelherold
243
12k
Transcript
։ൃΛޮԽ͢Δ ςετͷσβΠϯύλʔϯ
"CPVUNF
4XJGUϲ݄ͷਓؒ ࢦఠɾΞυόΠεܴʂ
ࠓհ͢Δύλʔϯ
ܕʹΑΔޚ
ςετ ༰қઃܭ
ςετͷ ߏԽ
σόοάͷ ޮԽ
લͷͷ΄ͲΦεεϝ
࣮ྫ͋Γ·͢
None
None
ܕʹΑΔޚ
ͦͦςετͬͯ ޮతͳͷͩΖ͏͔ʁ
ߏจϋΠϥΠτ Ϧϯτ ੩తܕݕࠪ ୯ମɾ݁߹ςετ &&ςετ खಈಈ࡞֬ೝ όά9Λݟ͚ͭͨॴ όά9
ߏจϋΠϥΠτ Ϧϯτ ੩తܕݕࠪ ୯ମɾ݁߹ςετ &&ςετ खಈಈ࡞֬ೝ όά" ্ͷํͰࢭ·Δͱ ॴཁ͕͍࣌ؒ όά#
ςετͩͱ͕࣌ؒ ͔͔Δ
ͳΔ͘ςετલʹ όάΛݟ͚͍ͭͨ ͜Ε͕ޮత
Semantic Type σβΠϯύλʔϯ
จࣈྻͱͯ͠ͷૢ࡞ ඞཁͳ͍ͷͰӅ͢ ҙຯʹΑΔಠࣗܕ 5FTUBCMF%FTJHO&YBNQMF(JU)VC(JU)VC6TFSTXJGU--
Ϣʔβʔ໊Λड͚औΕΔ ؔʹ͔ͤ͠ͳ͍ 5FTUBCMF%FTJHO&YBNQMF(JU)VC(JU)VC3FQPTJUPSZTXJGU--
ؒҧͬͨॲཧΛॻ͖ͮΒ͍ Մಡੑߴ·Δ
Registration Token σβΠϯύλʔϯ
ඞཁͳࣄલͷॲཧΛ Εͳ͍Α͏ʹ͢Δύλʔϯ
5PLFO͕ඞཁ 5BCMF7JFX$FMMΛ࡞Δؔ 5FTUBCMF%FTJHO&YBNQMF.WD"SDIJUFDUVSF4UBSHB[FST4UBSHB[FS$FMMTXJGU--
উखʹ࡞Εͳ͍ ొ͢ΔͱೖखͰ͖Δ 5FTUBCMF%FTJHO&YBNQMF.WD"SDIJUFDUVSF4UBSHB[FST4UBSHB[FS$FMMTXJGU--
ඞཁͳࣄલͷॲཧΛΕΔͱ ܕݕࠪʹ௨Βͳ͍
ςετ ༰қઃܭ
ਓؒςετ༰қͳ ͷ͔͠ςετͰ͖ͳ͍
ViewController Factory σβΠϯύλʔϯ
3FOBNFͳͲͰ 4UPSZCPBSEͱͷ߹ੑ ؆୯ʹյΕΔ 5)&ݫ͍͠
7JFX$POUSPMMFSͷ࡞ؔ 'PSDF6OXSBQܕ͜͜Ͱଋറ 5FTUBCMF%FTJHO&YBNQMF.WD"SDIJUFDUVSF4UBSHB[FST4UBSHB[FST.WD$PNQPTFSTXJGU--
͜͜Ͱ׆͖Δ 7JFX$POUSPMMFSͱ4UPSZCPBSEͷ߹ੑΛݕূ 5FTUBCMF%FTJHO&YBNQMF5FTUT.WD"SDIJUFDUVSF4UBSHB[FS.WD$PNQPTFS5FTUTTXJGU
͠࡞Εͳ͔ͬͨΒҟৗ ࣮ࡍʹදࣔ·Ͱ࣮ߦ 5FTUBCMF%FTJHO&YBNQMF5FTUT/BWJHBUPS5FTU/BWJHBUPSTXJGU
State-Machine Model σβΠϯύλʔϯ
.7 ͷ.PEFMͷ ཏςετ͍͠ ཏ͖͠Εͳ͍ʂ
.PEFMͷঢ়ଶભҠΛ੍ݶ ͔ͩΒ
.firstFetching .fetched(.success(x)) .fetching(.success(x)) .fetched(.failure(e)) .fetching(.failure(e)) FOVN͕ศར 5FTUBCMF%FTJHO&YBNQMF.WD"SDIJUFDUVSF4UBSHB[FST4UBSHB[FST.PEFMTXJGU--
ͦΕͧΕͷҹΛ ςετ͢Δ͚ͩͰΑ͍
.firstFetching .fetched(.success(x)) .fetching(.success(x)) .fetched(.failure(e)) .fetching(.failure(e)) ͜ͷྫͰຊͰཏ 5FTUBCMF%FTJHO&YBNQMF.WD"SDIJUFDUVSF4UBSHB[FST4UBSHB[FST.PEFMTXJGU--
ঢ়ଶ͕രൃ͢Δલʹ ঢ়ଶΛ੍ݶͯ͠ѹతཏ
ςετͷ ߏԽ
ςετ͕૿͑ΔʹͭΕ ςετࣗମͷอकੑ͕ॏཁʹͳΔ
Parameterized Test σβΠϯύλʔϯ
ྨࣅͨ͠ςετέʔε͕ ଟ͍߹ͷύλʔϯ
ςετέʔεΛ σʔλߏʹམͱ͢ ෳͷςετέʔεΛ·ͱΊΔ 5FTUT.JSSPS%J⒎,JU5FTUT%J⒎BCMF4FU5FTUTTXJGU- ˞͍͍ྫ͕αϯϓϧʹͳ͔ͬͨͷͰผ͔Βर͍ͬͯ·͢ɻ
ςετέʔεϧʔϓͰ࣮ߦ͢Δ 5FTUT.JSSPS%J⒎,JU5FTUT%J⒎BCMF4FU5FTUTTXJGU- ˞͍͍ྫ͕αϯϓϧʹͳ͔ͬͨͷͰผ͔Βर͍ͬͯ·͢ɻ
ςετέʔεΛྔ࢈Ͱ͖Δ 5FTUT.JSSPS%J⒎,JU5FTUT%J⒎BCMF4FU5FTUTTXJGU- ˞͍͍ྫ͕αϯϓϧʹͳ͔ͬͨͷͰผ͔Βर͍ͬͯ·͢ɻ
MJOFΛLFZʹ͢Δͱ ॴ͕Θ͔Γ͍͢ 5FTUT.JSSPS%J⒎,JU5FTUT%J⒎BCMF4FU5FTUTTXJGU- ˞͍͍ྫ͕αϯϓϧʹͳ͔ͬͨͷͰผ͔Βर͍ͬͯ·͢ɻ
Promisified Test σβΠϯύλʔϯ
ඇಉظςετΈ͕ଟ͍ ಡΈͮΒ͍͜ͱ͕ଟ͍
None
Ұํ+4քͰ1SPNJTFʹ ΑΔඇಉظςετ͕༏ ඇಉظͳͷऔಘͷσβΠϯύλʔϯ
J04Ͱ͍͍ͨʜ
None
BTZODͱ͍͏ ؔͰแΉ ςετέʔε 1SPNJTFΛฦ͢ 5FTUBCMF%FTJHO&YBNQMF5FTUT(JU)VC(JU)VC"QJ5FTUTTXJGU
9$5FTU$BTF ͏·͘ϒϦοδ 1SPNJTF͕ղܾ͞ΕͨΒςετޭ غ٫͞ΕͨΒςετࣦഊ 5FTUBCMF%FTJHO&YBNQMF5FTUT"TZODTXJGU
ಡΈ͍͢ ॻ͖͍͢
σόοάͷ ޮԽ
Diff Assertion σβΠϯύλʔϯ
Α͋͘Δςετ .JSSPS%J⒎,JU3&"%.&NE
ಡΊ͵
։ൃ͠·ͨ͠
͜͏͢Δͱʜ .JSSPS%J⒎,JU3&"%.&NE
None
.JSSPSͱ͍͏3FqFDUJPO"1*Λ ͬͯɺߏతͳEJ⒎Λܭࢉ
ͬͯΈ͍ͯͩ͘͞ʂ ˒Β͑Δͱخ͍͠Ͱ͢ʂ
·ͱΊ ͞·͟·ͳύλʔϯΛۦͯ͠ ޮతʹ։ൃ͠·͠ΐ͏
Φεεϝͷࢿྉ ςετքͰ༗໊ͳ σβύλຊ ϞοΫεύΠελϒͷ ఆٛɺࠓհͨ͠ ύλʔϯͷൃݩ͕ ͨ͘͞Μࡌͬͯ·͢