$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Android CI: 2016 edition
Search
Yusuke Yagyu
February 19, 2016
Technology
3
2.3k
Android CI: 2016 edition
DroidKaigi 2016 の発表資料です。
Yusuke Yagyu
February 19, 2016
Tweet
Share
More Decks by Yusuke Yagyu
See All by Yusuke Yagyu
ペパボのデザインシステムと、モバイル領域における取り組み
gyugyu
0
1.1k
Dart Sass であれを作った
gyugyu
0
76
少し変わった論理削除
gyugyu
3
17k
Other Decks in Technology
See All in Technology
sre本読んだ感想
pisakun
0
170
間違いだらけのポストモーテム - ホントに役立つレビューはこうだ!
jacopen
5
900
プロセス改善とE2E自動テストによる、プロダクトの品質向上事例
tomasagi
0
410
開発者向けツールを魔改造してセキュリティ診断ツールを作っている話 - 第1回 セキュリティ若手の会 LT
pizzacat83
0
140
Amazon ECSとCloud Runの相互理解で広げるクラウドネイティブの景色 / Mutually understanding Amazon ECS and Cloud Run
iselegant
18
2.3k
GeminiとUnityで実現するインタラクティブアート
hokkey621
0
370
品質管理チームのEMとして大事にしていること / QA EM
nihonbuson
0
300
情シスの引継ぎが大変という話
miyu_dev
2
540
RAMP2024
takeyukitamura
3
240
EthernetベースのGPUクラスタ導入による学びと展望
lycorptech_jp
PRO
0
470
徹底解説!Microsoft 365 Copilot の拡張機能 / Complete guide to Microsoft 365 Copilot extensions
karamem0
1
1.7k
.NET のUnified AI Building Blocks 入門...!
okazuki
0
150
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
A Tale of Four Properties
chriscoyier
156
23k
Writing Fast Ruby
sferik
627
61k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
27
2.1k
Code Reviewing Like a Champion
maltzj
520
39k
How GitHub (no longer) Works
holman
310
140k
Side Projects
sachag
452
42k
RailsConf 2023
tenderlove
29
920
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Transcript
ANDROID CI: 2016 EDITION YUSUKE YAGYU AT DROIDKAIGI 2016 DAY
02
ANDROID CI; 2016 EDITION ࣗݾհ ▸ GMO ϖύϘגࣜձࣾ ٕज़෦ ٕज़ج൫νʔϜ
▸ ͍Ζ͍Ζ࡞͍ͬͯΖ͍Ζ͢ਓ݉ςετ͓͡͞Μ ▸ Android ΞϓϦ։ൃࣗମϝΠϯͰͳ͍Ͱ͢ ▸ ຖே࠷৽ͷ PHP / Ruby / Python3 ΛϏϧυ͢Δͷ͕ੜ͖͕ ͍
ANDROID CI: 2016 EDITION ରௌߨऀ ▸ ॳ৺ऀʙதڃऀ ▸ ΞϓϦ։ൃͰ͖Δ͕ɺςετͲ͔͜ΒखΛ͚͍͍ͭͯͷ ͔Θ͔Βͳ͍ํ
▸ യવͱςετॻ͚Δ͕ɺAndroidStudio Ͱ͔͠ςετͨ͠ ͜ͱ͕ͳ͍ਓ
ANDROID CI: 2016 EDITION ຊͷςʔϚ ▸ ։ൃϑϩʔʹ͓͚Δ Android ςετͷྨ ▸
Android ςετࣗಈԽͷϓϥϯχϯά ▸ Android ʹ͓͚Δ CI ͷϓϥϯχϯά ▸ Android CI ͷύλʔϯ
ANDROID CI: 2016 EDITION DISCLAIMER ▸ ͜ͷεϐʔν20162݄࣌ͷใͰ͋Γɺ͝ཡͷ࣌Ͱ ࠷৽ͷใͰ͋Δ͜ͱΛอূ͠·ͤΜ
ANDROID CI; 2016 EDITION ࠷ॳʹେࣄͳ݁Λ ▸ Android ։ൃʹݶΒͣɺࣗಈςετ / CI
Ͳ͜ΛऔΔ͔ɺͲ ͜ΛΓࣺͯΔ͔ɺҰछͷՁஅͰ͋Δ ▸ அج४ͱͯ͠ɺٕज़త੍ɺਓతϦιʔεɺ࣌ؒత੍ɺ ༧ࢉͷ੍͕ڍ͛ΒΕΔ
։ൃϑϩʔʹ͓͚Δ ANDROID ςετͷྨ
ANDROID CI: 2016 EDITION ͓͞Β͍ɿҰൠతͳ։ൃϑϩʔ ▸ ʮҰൠతͳʯV ࣈ։ൃϞσϧ ▸ ཁ݅ੳˠجຊઃܭˠৄࡉઃܭˠ։ൃˠ
▸ ୯ମςετˠ݁߹ςετˠγεςϜςετˠडೖςετ
ANDROID CI: 2016 EDITION ςετͷछྨͱࣗಈςετͷରԠ ▸ ୯ମςετɿUnit Test, Ұ෦ͷ Instrumentation
Test ▸ ݁߹ςετɿ΄ͱΜͲͷ Instrumentation Test ▸ γεςϜɾडೖςετɿEnd-to-end Test ▸ ʢิʣ୳ࡧతςετɿओʹखಈʹΑΔ
ANDROID CI: 2016 EDITION UNIT TEST ▸ app/src/test σΟϨΫτϦ ▸
JVM / JUnit4 ϕʔεͷςετ ▸ ߴͳςετ ▸ Android SDK ґଘͷ෦ςετෆՄೳ
ANDROID CI: 2016 EDITION INSTRUMENTATION TEST (ANDROID TEST) ▸ app/src/androidTest
σΟϨΫτϦ ▸ ࣮ػɾΤϛϡϨʔλΛ༻ͯ͠ͷςετ ▸ Android SDK ґଘͷίʔυςετՄೳ ▸ Activity ͷදࣔςετՄೳ
ANDROID CI: 2016 EDITION INSTRUMENTATION TEST ͷϝϦοτ ▸ ֎෦ґଘʢe.g. Web
API ίʔϧʣͷ͋ΔίʔυΛϞοΫԽ Մೳ ▸ ϞοΫԽ͢Δ͜ͱͰྫ֎ঢ়ଶͷςετ͕Մೳ
ANDROID CI; 2016 EDITION INSTRUMENTATION TEST ͷ͠͞ ▸ e.g. Web
API ίʔϧ͕ଘࡏ͢Δ߹ɺϞοΫ͞ΕͨϨεϙ ϯε͕࠷৽ͷͷͰ͋Δ͜ͱΛͲ͏୲อ͢Δʁ ▸ Fixture ϕʔεʹͯ͠ JSON Schema Ͱݕূ͢Δʁ ▸ μϛʔ API αʔόΛཱͯΔʁ
ANDROID CI: 2016 EDITION END-TO-END TEST ▸ ϏϧυࡁΈͷ APK ʹର͢Δૢ࡞ςετ
▸ Πϯετʔϧࡁͷଞͷ APK ͱͷڠௐΛࢼݧ ▸ εΫϦʔϯγϣοτͷࡱӨՄೳ
ANDROID CI; 2016 EDITION END-TO-END TEST ͷ͠͞ ▸ e.g. Ͳ͜·ͰΛͯ͠
End-to-end Test ͱఆٛ͢Δ͔ʁ ▸ Production αʔόଓ͢Δʁ ▸ Build Flavor Λ༻ͯ͠σόοά༻ API Λ࣋ͭݕূ༻αʔό ʹଓ͢Δʁ
ANDROID ςετࣗಈ Խͷϓϥϯχϯά
ANDROID CI: 2016 EDITION ANDROID ࣗಈςετͰසग़͢Δ୯ޠ ▸ JUnit ▸ Mockito
▸ Robolectric ▸ Espresso ▸ UI Automator ▸ Appium
ANDROID CI: 2016 EDITION ROBOLECTRIC ▸ Unit Test ༻ͷ Android
SDK shim ▸ JVM ্Ͱ RuntimeException ʹͳΔ Android SDK ෦Λ shadow ʹࠩ͠ସ͑͢Δ ▸ Android SDK ґଘίʔυΛ Unit Test Մೳʹ͢Δ
ANDROID CI: 2016 EDITION ROBOLECTRIC༗༻͔ʁ ▸ ʮ෦తʹʯ༗༻ ▸ Bundle, Intent
୯७ͳ Map ͱͯ͠ར༻Մೳ ▸ AsyncTaskLoader ͷಉظԽ ▸ ͦΕҎ֎ͷʢಛʹ݁߹ߴ͍ʣ API ੬͍
ANDROID CI: 2016 EDITION MOCKITO ▸ Unit Test, Instrumentation Test
Ͱ͑ΔϞοΫϥΠϒϥϦ ▸ ଞʹީิ͋Δ ▸ Spy, Stub ͷҧ͍ʹҙ
ANDROID CI: 2016 EDITION ESPRESSO ▸ Instrumentation Test ͷߴϨϕϧϥούʔ ▸
ඇಉظͳ Activity ͷςετΛಉظతʹॻ͚Δ ▸ Testing Support Library ͷҰ෦
ANDROID CI: 2016 EDITION UI AUTOMATOR ▸ End-to-end Test πʔϧ
▸ Testing Support Library ͷҰ෦ ▸ Android OS >= 4.1
ANDROID CI: 2016 EDITION APPIUM ▸ Selenium ޓͷ End-to-end ςετπʔϧ
▸ Java, JavaScript (Node), .NET, PHP, Python, Ruby, Perl ͳͲ ݴޠΛΘͣςετίʔυ͕ॻ͚Δ
ANDROID CI: 2016 EDITION ςετϑΣʔζͱπʔϧબఆ ▸ ςετΛαϙʔτ͢ΔπʔϧΛબఆ͢Δ ▸ End-to-end Test
πʔϧબఆཁߟྀ ▸ Testing Support Library మ൘
ANDROID CI: 2016 EDITION ςετࣗಈԽͷηΦϦʔ ▸ ࣮ߦ୯ମʼ݁߹ʼडೖͷॱʹ͘ͳΔ ▸ ͭ·Γέʔε୯ମʼ݁߹ʼडೖͷॱʹ͢Δͷ͕ϕετ ▸
͜Ε Android ։ൃʹ͍ͭͯಉ༷ͷ͜ͱݴ͑Δ
ANDROID CI: 2016 EDITION ςετΛͲ͏ࣗಈԽ͢Δ͔ʁ ▸ ՔಇதͷΞϓϦ͕͋Δ߹ͱ৽ن։ൃͷ߹ͰมԽ ▸ Քಇதͷ߹ɿ Instrumentation
Test / End-to-end Test ͰՔ ಇΛ୲อ͠ͳ͕ΒϦϑΝΫλϦϯά ▸ ৽ن։ൃͷ߹ɿ MVP Architecture ͳͲͰ SDK ͔Βϩδο ΫΛΓ͠ Unit Test Λް͘͢Δ
ANDROID CI: 2016 EDITION Ͳ͜·ͰςετΛॻ͖͔͘ʁ ▸ ԾʹΧόϨοδ 100% ͩͬͨͱͯ͠ఆ࿙Ε͕ൃੜ͢Δ ▸
End-to-end Test ͰϋοϐʔύεʢޭύλʔϯʣҎ֎Λॻ ͘͜ͱ͍͠ ▸ ʮ҆৺͢Δ·ͰςετΛॻ͘ʯ(@ahomu)
ANDROID CI: 2016 EDITION ٯʹݴ͑ ▸ End-to-end Test ͚ͩΛॻ͍ͯʮಈ͘͜ͱ͚ͩʯ୲อ͢Δ ͷҰͭͷख
▸ ςετͷϓϥϯχϯάਓతϦιʔεͷଟՉɺϝϯόʔͷٕ ज़ྗɺϦϦʔε·ͰͷΓ࣌ؒʹج͍ͮͯಋग़͢Δ
ANDROID CI: 2016 EDITION ॏཁͳͷ ▸ νʔϜͷϝϯόʔશһ͕ࣗಈςετͷॏཁ͞Λ࣮ײ͢Δ͜ͱ ▸ νʔϜͷ։ൃऀશһ͕࣮ࡍʹखΛಈ͔ͯ͠ςετίʔυΛॻ ͚ΔΑ͏ʹͳΔ͜ͱ
▸ ςετίʔυΛॻ͘ͷ͕͍͠෦ΛΓ͚ΒΕΔʮςε τʹڧ͍ΤϯδχΞʯ͕͍Δͱͳ͓Α͍
ANDROID ʹ͓͚Δ CI ͷϓϥϯχϯά
ANDROID CI: 2016 EDITION Ωʔϫʔυ ▸ Jenkins ▸ ίϯςφϕʔε CI
αʔϏε ▸ Device Farm ▸ Smartphone Test Farm
ANDROID CI: 2016 EDITION JENKINS ▸ Jenkins + Git Plugin
/ GitHub Plugin ▸ αʔόߏΛίϯτϩʔϧՄೳʹ࣮ػଓՄೳ ▸ Unit Test, Instrumentation Test, End-to-end Test શͯΧόʔ ▸ ʮJenkins ৬ਓʯ
ANDROID CI: 2016 EDITION ίϯςφϕʔε CI ▸ e.g. Travis CI,
Circle CI, Drone, Wercker… ▸ ൺֱత҆Ձʢ̌ԁʙʣͰςετՄೳ ▸ JVM ϕʔεͷߴςετΛಘҙͱ͢Δ ▸ Activity Test / End-to-End Test Λߦ͏ͳΒผͷΈ͕ඞཁ
ANDROID CI: 2016 EDITION DEVICE FARM ▸ ෳͷ࣮ػʢɺOSόʔδϣϯʣΛςετ࣮ߦڥͱ͠ ͯ͑Δ ▸
ಠࣗςετ DSL, Web ϕʔεͷը໘ૢ࡞ͳͲ ▸ DFaaS (Device Farm as a Service) ͷ Amazon / Google ࢀೖʢGoogle Cloud Test Lab Closed Test தʣ
ANDROID CI: 2016 EDITION CI ͚ DFAAS ͷબఆج४ ▸ طଘͷςετࢿ࢈
(Instrumentation Test, End-to-end Test) ͕͑Δ͔ʁ ▸ Jenkins Plugin ͕༻ҙ͞Ε͍ͯΔ͔ʁ ▸ Gradle Plugin ͕༻ҙ͞Ε͍ͯΔ͔ʁ ▸ Web API ͕༻ҙ͞Ε͍ͯΔ͔ʁ
ANDROID CI: 2016 EDITION SMARTPHONE TEST FARM (STF) ▸ Device
Farm Λ in-house Ͱ࣋ͭπʔϧ ▸ Device Farm ͷඪ४తͳػೳΛҰ௨Γ࣋ͭ ▸ adb connect ʹΑΔϦϞʔτσόοά
ANDROID CI: 2016 EDITION STF 2.0 ▸ REST APIʢঢ়ଶɺϩοΫऔಘʣͷՃ ▸
ΑΓࣗಈςετͱੑͷߴ͍ػೳΛऔಘ
ANDROID CI: 2016 EDITION CI Λલఏͱͨ͠ςετΛॻ͘ ▸ ςετલޙͰͷঢ়ଶ͕มΘΒͳ͍͜ͱΛ୲อ͢Δ ▸ ΤϛϡϨʔλΛഁغ͢ΔɺΛϫΠϓ͢ΔͳͲ
▸ ୯ମʼ݁߹ʼडೖͷέʔεηΦϦʔΛकΒͳ͍ͱɺ͙͢ʹ ࣮ߦ͕࣌ؒരൃతʹ͘ͳΔ
ANDROID CI: 2016 EDITION ϓϥϯχϯάઓज़ ▸ Jenkins Λϝϯςφϯε͢ΔਓతϦιʔε͕֬อͰ͖ΔͷͰ ͋ΕɺJenkins ▸
Jenkins Λϝϯςφϯε͢ΔਓతίετΛ DFaaS ར༻ྉʹ సԽͰ͖ΔͳΒɺίϯςφϕʔε CI + DFaaS
ANDROID CI: 2016 EDITION େࣄͳͷ ▸ CI Λߦ͏͜ͱͰࣗಈςετΛश׳Խ͠ɺ࣭ΛԼ͛ͳ͍͜ ͱΛνʔϜͷϝϯόʔશһͰ߹ҙ͢Δ͜ͱ ▸
ݱ࣌Ͱ Device Farm աظʹ͋Γɺಛఆͷϓϥοτ ϑΥʔϜʹաʹґଘ͢ΔͱɺϨΨγʔԽ͢ΔϦεΫΛ๊͑ Δ
ANDROID CIͷύ λʔϯ
ANDROID CI: 2016 EDITION ύλʔϯ̍ ▸ Jenkins + ࣮ػଓʢ͘͠ΤϛϡϨʔλʣ ▸
࠷γϯϓϧͳߏ ▸ ༨ΓϦιʔεͰελʔτͰ͖Δͱ͍͏ख͕ܰ͋͞Δ ▸ ͷଟ༷ԽʹखಈͰਵ͠ͳ͚ΕͳΒͳ͍
ANDROID CI: 2016 EDITION ύλʔϯ̎ ▸ Jenkins + (Docker) +
STF + ࣮ػଓ ▸ γϯϓϧͳߏΛ֦ுͯ͠ɺͷଟ༷ੑʹਵՄೳʹͨ͠ ύλʔϯ ▸ Λ༻ҙ͢Δίετͱϝϯςφϯεʹ͔͔ΔਓతϦιʔε ͕՝
ANDROID CI: 2016 EDITION ύλʔϯ̏ ▸ ίϯςφϕʔε CI αʔϏε +
DFaaS ▸ ϝϯςφϯεϑϦʔͳ CI ύλʔϯ ▸ DFaaS ͷอ࣋͢Δʹ੍Λड͚Δ
ANDROID CI: 2016 EDITION ฐࣾʹ͓͚Δ CI ͷ࠾༻ঢ়گ ▸ minne ϞόΠϧΞϓϦʹ
CI ಋೖ ▸ ύλʔϯ̎ͱύλʔϯ̏Λซ༻͠ɺൺֱݕ౼த
ANDROID CI: 2016 EDITION ݁Λ܁Γฦ͠ ▸ Android ։ൃʹݶΒͣɺࣗಈςετ / CI
Ͳ͜ΛऔΔ͔ɺͲ ͜ΛΓࣺͯΔ͔ɺҰछͷՁஅͰ͋Δ ▸ அج४ͱͯ͠ɺٕज़త੍ɺਓతϦιʔεɺ࣌ؒత੍ɺ ༧ࢉͷ੍͕ڍ͛ΒΕΔ
ANDROID CI: 2016 EDITION ൃදҎ্Ͱ͢ ▸ ͋Γ͕ͱ͏͍͟͝·ͨ͠