ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Build Automation for Mobile 
or 
How to Deliver Quality Apps Continiously 
Angelo R¨¹ggeberg
2 
Things to remember 
?Publishing your App should not be 
painfull¡° 
Angelo R¨¹ggeberg 
?Code Quality Matters¡° 
Angelo R¨¹ggeberg
3 
Who am I? 
? Mobile Development 
? Android 
? iOS 
? Backend 
? Cloud Infrastructure 
http://plus.google.com/+AngeloR¨¹ggeberg 
http://s3xy4ngyc.github.io/ s3xy4ngyc
4 
Release Process 
Current Situation
5 
Release Process 
Current Situation
6 
Release Process 
the future 
Everything you have to do afterwards is 
git push
7 
Release Process 
the future
8 
Build Automation 
What will we be using 
jenkins 
Test Driven Development 
Git 
Beta Distribution 
Nightly Versions 
Gradle
9 
Build Automation 
Benefits 
? New Features are Live ASAP 
? As Soon As Pushed 
? Only Stable and Tested Builds can be Pushed 
? No more unstable Releases 
? Less Human Testing 
? No more Sharing of Sensitive Data 
? Keystores 
? Logins
10 
Build Automation 
Jenkins 
Jenkins is an award-winning application that monitors executions of repeated jobs, such as ? Building/testing software projects continuously 
? Monitoring executions of externally-run jobs 
Get Jenkins at: http://jenkins-ci.org/
11 
Build Automation 
Build Pipeline 
? Sample Build Pipeline: 
compile 
lint 
Tests 
sonar 
monkey 
runner 
distribute
12 
Build Automation 
Build Pipeline 
? Distribution will only Happen if all Previous Steps Succeed 
? Tests, Code Analysis, etc. can Run Parallel 
? Step by Step enables Failing Fast 
? Resource Hungry Jobs like Monkey Runner will be triggered only if needed
13 
Jenkins 
Usefull Tipps 
? Clone Workspace SCM Plugin 
? Shared Workspaces may have locks 
? https://wiki.jenkins-ci.org/display/JENKINS/Clone+Workspace+SCM+Plugin 
? Polling Sucks 
? use Git Hooks! 
? Do not run on a Small Virtual Machine 
? Android Emulator needs some Hardware 
? Intel HAX strongly Recommended!
14 
Jenkins 
Build Monitor Plugin
15 
Jenkins 
Build Pipeline View Plugin
16 
Jenkins 
Monitoring Plugins
17 
Build Automation 
gradle 
? Best of ANT / Maven / GANT / Ivy 
? Based on Groovy Scripts 
? Expressive DSL 
? (Flexible) Convention over Configuration 
? Easy to extend 
? ?Make the impossible possible, make the possible easy 
and make the easy elegant.¡±
18 
gradle 
flavoring 
? Staging, Dev and Live Packages 
? On Your Test Device no Constant Uninstalling 
? Adjustable Configurations without Code Changes 
? Why? 
? Reproduce able builds, easy setup
19 
gradle 
sample Code
20 
gradle 
sample Code 
Project Setup Flavoring 
? Same Folder Structure for 
every Flavor 
? Flavor Specific files Overwrite 
Files from Main 
? Only Overwrite What your 
Flavor Needs 
? Flavor Only Files Possible
21 
gradle 
sample Code 
Example Flavor Specific Manifest 
? Only Provider defined 
? Everything else comes from main/AndroidManifest.xml
22 
Build Automation 
git 
? Branching 
? Opensource 
? Integrated and Extended Implementations
23 
Git 
Git Workflow 
Git Flow Branching Model 
source: www.atlassian.com
24 
Jenkins 
Git Flow and Jenkins Examples 
? Staging 
? Hook on develop Branch 
? Nightly 
? Time Based Build (eg once a day at 0 AM) 
? builds newest feature Branch 
? Live 
? Only Builds release Tags 
? Release Notes are Tag Message
25 
Beta Test Distribution
26 
Beta Test Distribution 
Examples 
? Google Play 
? Alpha / Channel 
? Works on every Device that has The Playstore 
? Crashlytics 
? Distribution Groups & User Level 
? gradle Integration 
? free 
? HokeyApp 
? Comercial
27 
Unit Testing 
WHY? 
Testing - Do it
28 
Unit Testing 
WHY?
29 
Unit Testing 
WHY? 
? Code Quality Matters! 
? Insurance everything still works 
? As it should be working 
? Refactoring made easy 
? Unittests are somehow a Functional Documentation
30 
Unit Testing 
Some Tipps: 
? Tests first! 
? Simplest and dumbest way to implement 
? Test Orientation Changes 
? Test State Changes 
? Lock Screen 
? Incoming calls 
? etc. 
? Check Code Coverage
31 
Test Frameworks 
Unittests 
? Robolectric 
? No Emulator Needed 
? No Mocking Frameworks Needed 
? API Level Emulation only up to 18 (currently) 
? Robotium 
? Silenium for Android 
? User Scenarios 
? Default Android Testing Framework
32 
Test Frameworks 
UI Testing 
? Espresso 
? Ui Testing 
? Double Espresso 
? Espresso Gradle Port 
? Ui Automator 
? Android Default UI Testing Framework
33 
Mocking
34 
Test Frameworks 
Device Testing 
Distributing instrumentation tests 
http://square.github.io/spoon/
35 
Test Frameworks 
Device Testing
36 
Test Frameworks 
Device Testing
37 
Test Frameworks 
Device Testing
38 
Build Automation 
Measure Code Quality 
? Measure Code Quality over Time 
Duplicated code 
? Coding standards 
? Unit tests 
? Complex code 
? Potential bugs 
? Comments 
? Design and architecture
39 
Test Frameworks 
Code Coverage
40 
Test Frameworks 
Code Coverage
41 
Build Automation 
Static Code Analysis
42 
Build Automation 
Static Code Analysis 
? Testing your Application makes your life more Stress free 
? Code Quality 
? Less Production Crashes 
? Don¡¯t develop Stuff that should not go live 
? Use Gradle Flavors!
43 
Build Automation 
Final Thoughts 
? Testing your Application makes your life more Stress free 
? Code Quality 
? Less Production Crashes 
? Don¡¯t develop Stuff that should not go live 
? DONE = RELEASED 
? Use Gradle Flavors!
44 
Release Process 
the future
>> /etc/

More Related Content

Build Automation in Android

  • 1. Build Automation for Mobile or How to Deliver Quality Apps Continiously Angelo R¨¹ggeberg
  • 2. 2 Things to remember ?Publishing your App should not be painfull¡° Angelo R¨¹ggeberg ?Code Quality Matters¡° Angelo R¨¹ggeberg
  • 3. 3 Who am I? ? Mobile Development ? Android ? iOS ? Backend ? Cloud Infrastructure http://plus.google.com/+AngeloR¨¹ggeberg http://s3xy4ngyc.github.io/ s3xy4ngyc
  • 4. 4 Release Process Current Situation
  • 5. 5 Release Process Current Situation
  • 6. 6 Release Process the future Everything you have to do afterwards is git push
  • 7. 7 Release Process the future
  • 8. 8 Build Automation What will we be using jenkins Test Driven Development Git Beta Distribution Nightly Versions Gradle
  • 9. 9 Build Automation Benefits ? New Features are Live ASAP ? As Soon As Pushed ? Only Stable and Tested Builds can be Pushed ? No more unstable Releases ? Less Human Testing ? No more Sharing of Sensitive Data ? Keystores ? Logins
  • 10. 10 Build Automation Jenkins Jenkins is an award-winning application that monitors executions of repeated jobs, such as ? Building/testing software projects continuously ? Monitoring executions of externally-run jobs Get Jenkins at: http://jenkins-ci.org/
  • 11. 11 Build Automation Build Pipeline ? Sample Build Pipeline: compile lint Tests sonar monkey runner distribute
  • 12. 12 Build Automation Build Pipeline ? Distribution will only Happen if all Previous Steps Succeed ? Tests, Code Analysis, etc. can Run Parallel ? Step by Step enables Failing Fast ? Resource Hungry Jobs like Monkey Runner will be triggered only if needed
  • 13. 13 Jenkins Usefull Tipps ? Clone Workspace SCM Plugin ? Shared Workspaces may have locks ? https://wiki.jenkins-ci.org/display/JENKINS/Clone+Workspace+SCM+Plugin ? Polling Sucks ? use Git Hooks! ? Do not run on a Small Virtual Machine ? Android Emulator needs some Hardware ? Intel HAX strongly Recommended!
  • 14. 14 Jenkins Build Monitor Plugin
  • 15. 15 Jenkins Build Pipeline View Plugin
  • 17. 17 Build Automation gradle ? Best of ANT / Maven / GANT / Ivy ? Based on Groovy Scripts ? Expressive DSL ? (Flexible) Convention over Configuration ? Easy to extend ? ?Make the impossible possible, make the possible easy and make the easy elegant.¡±
  • 18. 18 gradle flavoring ? Staging, Dev and Live Packages ? On Your Test Device no Constant Uninstalling ? Adjustable Configurations without Code Changes ? Why? ? Reproduce able builds, easy setup
  • 20. 20 gradle sample Code Project Setup Flavoring ? Same Folder Structure for every Flavor ? Flavor Specific files Overwrite Files from Main ? Only Overwrite What your Flavor Needs ? Flavor Only Files Possible
  • 21. 21 gradle sample Code Example Flavor Specific Manifest ? Only Provider defined ? Everything else comes from main/AndroidManifest.xml
  • 22. 22 Build Automation git ? Branching ? Opensource ? Integrated and Extended Implementations
  • 23. 23 Git Git Workflow Git Flow Branching Model source: www.atlassian.com
  • 24. 24 Jenkins Git Flow and Jenkins Examples ? Staging ? Hook on develop Branch ? Nightly ? Time Based Build (eg once a day at 0 AM) ? builds newest feature Branch ? Live ? Only Builds release Tags ? Release Notes are Tag Message
  • 25. 25 Beta Test Distribution
  • 26. 26 Beta Test Distribution Examples ? Google Play ? Alpha / Channel ? Works on every Device that has The Playstore ? Crashlytics ? Distribution Groups & User Level ? gradle Integration ? free ? HokeyApp ? Comercial
  • 27. 27 Unit Testing WHY? Testing - Do it
  • 29. 29 Unit Testing WHY? ? Code Quality Matters! ? Insurance everything still works ? As it should be working ? Refactoring made easy ? Unittests are somehow a Functional Documentation
  • 30. 30 Unit Testing Some Tipps: ? Tests first! ? Simplest and dumbest way to implement ? Test Orientation Changes ? Test State Changes ? Lock Screen ? Incoming calls ? etc. ? Check Code Coverage
  • 31. 31 Test Frameworks Unittests ? Robolectric ? No Emulator Needed ? No Mocking Frameworks Needed ? API Level Emulation only up to 18 (currently) ? Robotium ? Silenium for Android ? User Scenarios ? Default Android Testing Framework
  • 32. 32 Test Frameworks UI Testing ? Espresso ? Ui Testing ? Double Espresso ? Espresso Gradle Port ? Ui Automator ? Android Default UI Testing Framework
  • 34. 34 Test Frameworks Device Testing Distributing instrumentation tests http://square.github.io/spoon/
  • 35. 35 Test Frameworks Device Testing
  • 36. 36 Test Frameworks Device Testing
  • 37. 37 Test Frameworks Device Testing
  • 38. 38 Build Automation Measure Code Quality ? Measure Code Quality over Time Duplicated code ? Coding standards ? Unit tests ? Complex code ? Potential bugs ? Comments ? Design and architecture
  • 39. 39 Test Frameworks Code Coverage
  • 40. 40 Test Frameworks Code Coverage
  • 41. 41 Build Automation Static Code Analysis
  • 42. 42 Build Automation Static Code Analysis ? Testing your Application makes your life more Stress free ? Code Quality ? Less Production Crashes ? Don¡¯t develop Stuff that should not go live ? Use Gradle Flavors!
  • 43. 43 Build Automation Final Thoughts ? Testing your Application makes your life more Stress free ? Code Quality ? Less Production Crashes ? Don¡¯t develop Stuff that should not go live ? DONE = RELEASED ? Use Gradle Flavors!
  • 44. 44 Release Process the future

Editor's Notes

  1. Imperative No phases Hard to read Flexbile Hard to extend No conventions (init, setup,..)
  2. Dynamically create execution order
  3. Groovy based build system based on ant
  4. Groovy based build system based on ant