Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Droidcon London 2013 : Beef Up Your Android Apps With Java tools

Droidcon London 2013 : Beef Up Your Android Apps With Java tools

Jérôme Van Der Linden

October 25, 2013
Tweet

More Decks by Jérôme Van Der Linden

Other Decks in Programming

Transcript

  1. Stéphane Nicolas BoundBox   And  others  :  RoboDemo,  Quality  Analysis

     Tools  for  Android,  android-­‐maven-­‐plugin,  …   3   +stephane  nicolas   snicolas   stephanenicolas  
  2. The ultimate profile # run junit, robotium, robolectric tests and

    get code coverage! > mvn clean install –P jacoco! 20  
  3. Maven Profiles Junit  +   Robo,um Robolectric UIAutomator Code  

    coverage Quality   checks   (Checkstyle  +   findbugs  +   PMD  +  lint) Sonar standard emma cobertura ui   automator spoon jacoco 21   x2  
  4. 22   hOps://github.com/SonarCommunity/sonar-­‐android   # analyse code (pmd, checkstyle, findbugs,

    lint) and report in sonar! > mvn sonar:sonar –P jacoco! Android Lint Sonar plugin
  5. Not an archetype (see akquinet : http://goo.gl/O46LIw) Only samples Do

    not use everything ! Pick up what you need ! 23  
  6. 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  
  7. 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,  …)     Lessons learned 25  
  8. 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       Lessons learned 26  
  9. Lint UIAutomator Monkey & Monkey Runner Robolectric PMD, checkstyle, findbugs

    Emma, Cobertura, Jacoco 28   Before     V  0.6  
  10. 31   Quality the gradle way # run junit, robotium,

    robolectric tests ! # AND Chekstyle + PMD + Findbugs + Classycle! > gradle check! # report in sonar! > gradle sonarRunner!
  11. 33   Feature Gradle Maven Application Variants & Manifest merging

    ? Standard  tests  &  Robo,um Code  Coverage   Robolectric UI  automator  /  Monkey  /   Monkey  Runner PMD  /  CheckStyle  /   FindBgugs  /  Classycle  /  Lint Sonar  &  Project  Sites Gradle 0.6.1 VS Maven 3.6.1
  12. 34   Android offers lots of quality tools lots of

    testing methods rapid testing Everything gets easier to use Build rock solid apps
  13. Thank You ! Any Question ? Stéphane Nicolas & Jérôme

    Van Der Linden 35   @jeromevdl   +jerome  van  der  linden   jeromevdl   +stephane  nicolas   snicolas   stephanenicolas