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
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
5
1.5k
Arm移行タイムアタック
qnighy
0
340
Better Code Design in PHP
afilina
PRO
0
130
C++でシェーダを書く
fadis
6
4.1k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
900
Vapor Revolution
kazupon
1
130
RubyLSPのマルチバイト文字対応
notfounds
0
120
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
210
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.8k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Speed Design
sergeychernyshev
25
620
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Become a Pro
speakerdeck
PRO
25
5k
The Invisible Side of Design
smashingmag
298
50k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Building Your Own Lightsaber
phodgson
103
6.1k
BBQ
matthewcrist
85
9.3k
A Tale of Four Properties
chriscoyier
156
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
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⒎Λܭࢉ
ͬͯΈ͍ͯͩ͘͞ʂ ˒Β͑Δͱخ͍͠Ͱ͢ʂ
·ͱΊ ͞·͟·ͳύλʔϯΛۦͯ͠ ޮతʹ։ൃ͠·͠ΐ͏
Φεεϝͷࢿྉ ςετքͰ༗໊ͳ σβύλຊ ϞοΫεύΠελϒͷ ఆٛɺࠓհͨ͠ ύλʔϯͷൃݩ͕ ͨ͘͞Μࡌͬͯ·͢