This document discusses how to use various Java quality tools to test and improve Android apps. It provides an overview of tools for unit testing, UI testing, code coverage, code quality checks, and continuous integration. It also describes a sample Maven project that demonstrates setting up these tools and running them with different Maven profiles. The project aims to show developers how to easily incorporate maturity practices from Java and leverage these tools to build more robust Android apps.
6. 6
Initial setup
#install Eclipse Juno or IntelliJ
#install ADT (for Eclipse)
#install a few Android SDK (i.e: 8,
11, 14, 17)
#install Hardware Acceleration from
Intel
#install X86 android emulator with
Hardware Acceleration Support
#install maven 3.0.3+
#install Jenkins
#install Jenkins Android
Emulator Plugin
JenkinsMaven
7. 7
#install Sonar
#install the Sonar Android Lint Plugin
git clone git@github.com:SonarCommunity/sonar-android.git
mvn clean install cp target/*.jar [SONAR_HOME]/extensions/plugins/
sonar.sh restart
#install the Sonar Emma Plugin
Sonar LintPMD Check
Style
findbugsEmma Cobertura
Initial setup :: Sonar
Jacoco
Thanks to Thomas Bores Florian Roncari
for their contributions to the sonar lint plugin.
8. 8
# clone the repository on GitHub
git clone git@github.com:stephanenicolas/Quality-Tools-for-Android.git
This projects combines many Quality Tools for Android.
It demonstrates how to set up those tools.
It is not intended to be used as a maven archetype.
No project will need all of those technologies,
take only what you need.
All configurations work both in IntelliJ, Eclipse, Maven CLI and
Jenkins.
11. 11
Standard profile :
Running tests and Quality checks
Robo
lectric
Robotium
JUnit
UI
Automator
Lint PMD Check
Style
findbugs
# run all tests
mvn clean install
12. 12
Emma profile :
JUnit tests and Emma code coverage in Sonar
Robo
tium
JUnit
Emma
Sonar
Lint PMD Check
Style
findbugs
# run standard junit tests and get code coverage
mvn clean install –P emma
# Report in Sonar
mvn sonar:sonar –P emma
13. 13
Cobertura profile :
Robolectric tests and Cobertura code coverage in Sonar
# run robolectric tests and get code coverage
mvn clean cobertura:cobertura –P cobertura
# Report in Sonar
mvn sonar:sonar –P cobertura
Robo
lectric
Cober
tura
Sonar
Lint PMD Check
Style
findbugs
14. 14
Jacoco profile :
Robolectric and standard tests and Jacoco code coverage in Sonar
# run robolectric tests and get code coverage
mvn clean install –P jacoco
# Report in Sonar
mvn sonar:sonar –P jacoco
Robo
lectric
Jacoco
SonarLint PMD Check
Style
findbugs
Robo
tium
JUnit
16. 16
Spoon profile :
Running Junit Robotium via Spoon
# run JUnit Robotium tests via spoon
mvn clean install –P spoon
Robotium
JUnit
Lint PMD Check
Style
findbugs Spoon
17. 17
Monkey profile :
Running Monkey tests
# run Monkey tests and get result in Sonar
mvn clean install –P monkey
Monkey
Lint PMD Check
Style
findbugs Sonar
18. 18
Monkey Runner profile :
Running Monkey runner tests
# run Monkey runner tests
#and get result in Sonar
mvn clean install –P monkeyrunner
Monkey
Runner
Lint PMD Check
Style
findbugs Sonar
19. 19
! Let’s take advantage of Java maturity.
! Testing and building more robust apps can be easy.
! Choose technologies that suit your needs.
! Clone our project on GitHub, try it, contribute !
Conclusion
http://goo.gl/pdwnq