Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
BEEF UP ANDROID APPS
USING JAVA TOOLS

Stéphane Nicolas &
Jérôme Van Der Linden
2	
  

Jerome Van Der Linden

android-­‐holo-­‐colors.com	
  

jeromevdl	
  

@jeromevdl	
  

+jerome	
  van	
  der	
  lin...
3	
  

Stéphane Nicolas
ox	
  
BoundB

And	
  others	
  :	
  RoboDemo,	
  Quality	
  Analysis	
  Tools	
  for	
  Android,	...
4	
  
5	
  

1

ONCE UPON A TIME
JAVA ENVIRONMENT
6	
  

4	
  
7	
  

Everything is testable
Everything is measurable
Everything is integrated
No excuses to have poor apps !
8	
  

Great !
9	
  

And me ?!
10	
  

2

WTF ?!
ANDROID IS JAVA !
11	
  

Almost YES…
… a story of
Virtual Machine

So what … ?
12	
  

3	
  
Oh Yeah !
14	
  

(almost)

(almost)

Everything is testable

Everything is measurable
BUT

Everything is NOT integrated
15	
  

Quality Tools for Android

http://goo.gl/zGFvda
16	
  

3

Quality Tools Android
Ant
18	
  

4

Quality Tools Android
Maven
19	
  

The magical

plugin

<plugin>!
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
"!
<artifactId>andr...
20	
  

The ultimate

profile

# run junit, robotium, robolectric tests and get code coverage!
> mvn clean install –P jacoc...
21	
  

Maven
Profiles

Junit	
  +	
  
Robo,um

Robolectric

UIAutomator

Code	
  
coverage

standard

emma
cobertura

ui	...
22	
  

Android Lint
Sonar plugin
# analyse code (pmd, checkstyle, findbugs, lint) and report in sonar!
> mvn sonar:sonar ...
23	
  

Not an archetype

(see akquinet : http://goo.gl/O46LIw)

Only samples
Do not use everything !
Pick up what you nee...
24	
  

Return of
real life experience
Maven	
  
Jenkins	
  
Sonar	
  (PMD,	
  checkstyle,	
  findbugs,	
  lint)	
  
Junit	...
25	
  

Lessons

learned

A	
  laborious	
  development	
  environment	
  :	
  
eclipse	
  +	
  maven	
  +	
  m2eclipse	
 ...
26	
  

Lessons

learned

A	
  robust	
  development	
  environment	
  :	
  
eclipse	
  +	
  maven	
  +	
  m2eclipse	
  +	...
27	
  

5

Quality Tools Android
Gradle
28	
  

Before	
  	
  
V	
  0.6	
  

Lint
UIAutomator

Monkey & Monkey Runner
Robolectric
PMD, checkstyle, findbugs
Emma, C...
Joke ?!
30	
  

V	
  0.6.+	
  

Lint
UIAutomator

Monkey & Monkey Runner
Robolectric
PMD, checkstyle, findbugs
Emma, Cobertura, Jac...
31	
  

Quality
#
#
>
#
>

the gradle way

run junit, robotium, robolectric tests !
AND Chekstyle + PMD + Findbugs + Class...
32	
  

6

Conclusion

Android is filling the gap
Gradle
Feature
Application Variants &
Manifest merging

Standard	
  tests	
  &	
  Robo,um

Code	
  Coverage	
  
Robolectri...
Android offers

34	
  

lots of quality tools
lots of testing methods
rapid testing
Everything gets easier
to use
Build ro...
35	
  

Thank You !
Any Question ?
stephanenicolas	
  
jeromevdl	
  

snicolas	
  
@jeromevdl	
  

Stéphane Nicolas &
Jérô...
36	
  

Quality Tools for Android

http://goo.gl/zGFvda
DroidconUK 2013 : Beef up android apps with java tools
Upcoming SlideShare
Loading in …5
×

DroidconUK 2013 : Beef up android apps with java tools

901 views

Published on

Our presentation at Droidcon London 2013 : Beef up Android Apps with Java Tools : how to take advantage of 17 years of experience in Java for Android.

Published in: Technology
  • Be the first to comment

DroidconUK 2013 : Beef up android apps with java tools

  1. 1. BEEF UP ANDROID APPS USING JAVA TOOLS Stéphane Nicolas & Jérôme Van Der Linden
  2. 2. 2   Jerome Van Der Linden android-­‐holo-­‐colors.com   jeromevdl   @jeromevdl   +jerome  van  der  linden  
  3. 3. 3   Stéphane Nicolas ox   BoundB And  others  :  RoboDemo,  Quality  Analysis  Tools  for  Android,  android-­‐maven-­‐plugin,  …   stephanenicolas   snicolas   +stephane  nicolas  
  4. 4. 4  
  5. 5. 5   1 ONCE UPON A TIME JAVA ENVIRONMENT
  6. 6. 6   4  
  7. 7. 7   Everything is testable Everything is measurable Everything is integrated No excuses to have poor apps !
  8. 8. 8   Great !
  9. 9. 9   And me ?!
  10. 10. 10   2 WTF ?! ANDROID IS JAVA !
  11. 11. 11   Almost YES… … a story of Virtual Machine So what … ?
  12. 12. 12   3  
  13. 13. Oh Yeah !
  14. 14. 14   (almost) (almost) Everything is testable Everything is measurable BUT Everything is NOT integrated
  15. 15. 15   Quality Tools for Android http://goo.gl/zGFvda
  16. 16. 16   3 Quality Tools Android Ant
  17. 17. 18   4 Quality Tools Android Maven
  18. 18. 19   The magical plugin <plugin>! <groupId>com.jayway.maven.plugins.android.generation2</groupId> "! <artifactId>android-maven-plugin</artifactId>! <version>3.6.1</version>! </plugin>!
  19. 19. 20   The ultimate profile # run junit, robotium, robolectric tests and get code coverage! > mvn clean install –P jacoco!
  20. 20. 21   Maven Profiles Junit  +   Robo,um Robolectric UIAutomator Code   coverage standard emma cobertura ui   automator spoon jacoco x2   Quality   checks   (Checkstyle  +   findbugs  +   PMD  +  lint) Sonar
  21. 21. 22   Android Lint Sonar plugin # analyse code (pmd, checkstyle, findbugs, lint) and report in sonar! > mvn sonar:sonar –P jacoco! hOps://github.com/SonarCommunity/sonar-­‐android  
  22. 22. 23   Not an archetype (see akquinet : http://goo.gl/O46LIw) Only samples Do not use everything ! Pick up what you need !
  23. 23. 24   Return of real life experience Maven   Jenkins   Sonar  (PMD,  checkstyle,  findbugs,  lint)   Junit  (Instrumenta[onTestCase)   ~  100  screens  (phone  +  tablet)   ~  5  developers  during  only  5  months   ~  60k  loc  (java),  15k  loc  (xml)   ~  400  unit  tests  :  not  an  excep[onal  coverage  (~  30%)   Built  on  each  commit  on  Jenkins  +  Genymo[on   0  lint,  pmd,  findbugs,  checkstyle  viola[ons   1  sonar  report  generated  each  night  with  those  metrics     è  An  happy  customer  J  
  24. 24. 25   Lessons learned A  laborious  development  environment  :   eclipse  +  maven  +  m2eclipse  +  android  m2e  connector   è Many  hours  lost  è  Use  IntelliJ  !     A  laborious  execu[on  environment  :  emulator   è  Too  slow  è  Use  Genymo[on  (or  at  least  a  device)  !     Not  enough  tests  :   è Instrumenta[onTestCase  are  too  heavy/slow  for  Unit  Tes[ng     è Use  Robolectric  and/or  think  about  MV*  paOern   è  Keep  Instrumenta[onTestCase  for  Android  specific  (Ac[vity,   Services,  …)    
  25. 25. 26   Lessons learned A  robust  development  environment  :   eclipse  +  maven  +  m2eclipse  +  android  m2e  connector   è  s[ll  some  problem  with  eclipse  and  maven  integra[on     About  tests   è Instrumenta[onTestCase  are  fast  enough  with  GenyMo[on   è  Robolectric  can’t  give  you  enough  confidence      
  26. 26. 27   5 Quality Tools Android Gradle
  27. 27. 28   Before     V  0.6   Lint UIAutomator Monkey & Monkey Runner Robolectric PMD, checkstyle, findbugs Emma, Cobertura, Jacoco
  28. 28. Joke ?!
  29. 29. 30   V  0.6.+   Lint UIAutomator Monkey & Monkey Runner Robolectric PMD, checkstyle, findbugs Emma, Cobertura, Jacoco
  30. 30. 31   Quality # # > # > the gradle way run junit, robotium, robolectric tests ! AND Chekstyle + PMD + Findbugs + Classycle! gradle check! report in sonar! gradle sonarRunner!
  31. 31. 32   6 Conclusion Android is filling the gap
  32. 32. Gradle Feature Application Variants & Manifest merging Standard  tests  &  Robo,um Code  Coverage   Robolectric UI  automator  /  Monkey  /   Monkey  Runner PMD  /  CheckStyle  /   FindBgugs  /  Classycle  /  Lint Sonar  &  Project  Sites 0.6.1 VS Maven Gradle Maven ? 33   3.6.1
  33. 33. Android offers 34   lots of quality tools lots of testing methods rapid testing Everything gets easier to use Build rock solid apps
  34. 34. 35   Thank You ! Any Question ? stephanenicolas   jeromevdl   snicolas   @jeromevdl   Stéphane Nicolas & Jérôme Van Der Linden +stephane  nicolas   +jerome  van  der  linden  
  35. 35. 36   Quality Tools for Android http://goo.gl/zGFvda

×