{"id":13647203,"url":"https://github.com/stephanenicolas/Quality-Tools-for-Android","last_synced_at":"2025-04-22T02:30:50.708Z","repository":{"id":6191948,"uuid":"7422457","full_name":"stephanenicolas/Quality-Tools-for-Android","owner":"stephanenicolas","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-05T03:03:14.000Z","size":4430,"stargazers_count":1266,"open_issues_count":33,"forks_count":235,"subscribers_count":115,"default_branch":"master","last_synced_at":"2024-10-29T20:00:03.573Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephanenicolas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-03T12:24:30.000Z","updated_at":"2024-07-19T15:02:10.000Z","dependencies_parsed_at":"2022-09-04T02:10:37.249Z","dependency_job_id":null,"html_url":"https://github.com/stephanenicolas/Quality-Tools-for-Android","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanenicolas%2FQuality-Tools-for-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanenicolas%2FQuality-Tools-for-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanenicolas%2FQuality-Tools-for-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanenicolas%2FQuality-Tools-for-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephanenicolas","download_url":"https://codeload.github.com/stephanenicolas/Quality-Tools-for-Android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250163564,"owners_count":21385260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:03:23.981Z","updated_at":"2025-04-22T02:30:49.982Z","avatar_url":"https://github.com/stephanenicolas.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Demo\"\u003e\u003c/A\u003eDemo"],"readme":"# Quality Tools for Android\n\n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/bugdroid-duke-armor.jpg\" \nwidth=\"350px\" /\u003e\n\nThis is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.\n\nThe idea is that Android programming is still in its infancy compared to the Java world. \nThe Android community needs more robustness in Android apps and it looks like a good idea to build on the Java world experience and use its best tools for Quality Analysis.\n\nWe want to provide a full featured industrial development environment that can be used to create more\nrobust projects on Android, by using any of the most interesting and popular technologies.\n\nHere are [some slides](https://speakerdeck.com/stephanenicolas/devoxx-2013-fr-beef-you-android-apps-using-java-tools) to present Quality Tools for Android.\n\n# Already integrated :\n\n* Standard Android testing framework and code coverage using emma, reported in Sonar. That also covers robotium, easy mock and mockito technologies.\n* Robolectric testing framework and code coverage using Cobertura, reported in Sonar. Now in same eclipse project / maven module as app under test [thanks to this thread](https://github.com/rgladwell/m2e-android/issues/52).\n* UI Automator testing through a new android maven plugin goal (to be released in android-maven-plugin-3.5.2) and result in sonar.\n* Espresso / Android test kit \n* Configuration works out of the box in eclipse\n* Lint integration via Maven.\n* PMD, findbugs, checkstyle integration via Maven, reported in Sonar.\n* [lint android maven lint](https://github.com/lewisd32/lint-maven-plugin) integration (pom checker)\n* Monkey testing is now automated and reported in Sonar.\n* Add [classycle](http://classycle.sourceforge.net/) support, to enforce architectural constraints, through [classycle maven plugin](https://github.com/hcoles/classycle-maven-plugin)\n* [Spoon from square](https://github.com/square/spoon), including screenshots during tests.\n*\n* [maven-android-sdk-deployer](https://github.com/mosabua/maven-android-sdk-deployer) to deliver android jars (including uiautomator)\n* [sonar android lint plugin](https://github.com/jeromevdl/sonar-android-lint-plugin) \n* [FEST Android](https://github.com/square/fest-android).\n* Jacoco [offline instrumentation](https://github.com/jacoco/jacoco/pull/64#issuecomment-12150910) for both robolectric and standard junit tests.\n* Testing  technologies integrated : \n    * Standard Android tests   \n        * easymock\n        * mockito\n        * mockwebserver\n        * robotium\n        * fest-android\n    * robolectric tests\n        * hamcrest \n        * easymock\n        * mockito\n* [Screenshot lib](https://github.com/rtyley/android-screenshot-lib) works during UIAutomator tests.\n* [BoundBox](https://github.com/stephanenicolas/boundbox) is used in some StandardAndroid tests and Robolectric tests.\n* support for [Travis CI](https://travis-ci.org/stephanenicolas/Quality-Tools-for-Android). \n* Build Status on Travis: [![Build Status on Travis:](https://api.travis-ci.org/stephanenicolas/Quality-Tools-for-Android.png)](https://api.travis-ci.org/stephanenicolas/Quality-Tools-for-Android)\n\n\n\n# What is missing (TODO/INTEGRATE) : \n\n1. get aggregated tests and code coverage for all testing technologies inside a nice Sonar dashboard for Android.\n2. add support for monkey runner through maven\n3. add calabash support.\n4. Add support for JUnit 4 on Android : http://stackoverflow.com/questions/9809180/why-is-junit-4-on-android-not-working\n\n# Usage\n\nThis section describes how to build \u0026 test the project using those different testing technologies.\n\nPlease note that this project is under active development.\nSome goals may require a snapshot version of the maven android plugin available \non [sonatype snapshot repo](https://oss.sonatype.org/content/repositories/jayway-snapshots/).\n\n## Install Android Latest SDK through Android SDK Manager\n\nThis can be done graphically, or [via command line (for CI servers)](http://stackoverflow.com/q/4681697/693752).\n\n## Install the Android SDK through maven-android-sdk-deployer\n\nAs it takes time to get android jars in maven central, including android UI automator jars in maven central,\nwe recommend to use [maven-android-sdk-deployer](https://github.com/mosabua/maven-android-sdk-deployer) to obtain android artefacts.\nThis step can also be executed on a CI server.\n\n```bash\n#install Android SDK 17 local files to local maven repo  \ngit clone git@github.com:mosabua/maven-android-sdk-deployer.git\ncd maven-android-sdk-deployer/\nmvn install -P 4.2\n#Add V4 support library (to use FEST Android)\ncd extras/compatibility-v4/\nmvn install\n```\n\n## Standard Android testing APIs and code coverage using emma\n\nTo build the sample project and run the sample app on a plugged rooted device / running emulator : \n\n```bash\n# in parent folder\nmvn clean install -P emma\nmvn sonar:sonar -P emma\n```\n\nyou will get tests results in : target/surefire-reports/.\nyou will get tests coverage in : target/emma/.\n\nHere is the result in sonar : \n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/screenshot-sonar-emma-config.png\" width=450px/\u003e\n\nYou may need to restart adb as root to be able to pull the emma coverage file. In a terminal, type :\n```bash\nadb root\n```\n\n## Robolectric and code coverage using cobertura\n\n```bash\n# in parent folder\nmvn clean cobertura:cobertura -P cobertura\nmvn sonar:sonar -P cobertura\n```\nHere is the result in sonar : \n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/screenshot-sonar-robolectric-config.png\" width=450px/\u003e\n\n\n## Unified code coverage for both Robolectric and standard Android Junit tests via Jacoco\n\nUsing offline instrumentation of Jacoco, it is possilbe to completly replace emma by jacoco for instrumentation.\nThis allows to get both robolectric and standard tests code coverage inside the same project dashboard with sonar.\n\n* Robolectric are considered standard unit tests.\n* standard Android Junit tests are considered as standard integration tests.\nThis makes sense as Robolectric tests mock an android platform and can be considered more \"unit\" tests thant standard android tests because the latter needs a real android platform and relies on networking, disk, locale, etc. \nIt would be better to be able to give names to the test suites inside the widget, and even to add more test suites, for instance to add UI testing (black box testing) or monkey testing. \n\n```bash\n# in parent folder\nmvn clean install -P jacoco\nmvn sonar:sonar -P jacoco\n```\nHere is the result in sonar : \n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/screenshot-sonar-jacoco.png\" width=450px/\u003e\n\n\n## UI Automator \n\n\n```bash\n# in parent folder\nmvn clean install -P uiautomator\nmvn sonar:sonar -P uiautomator\n```\nHere is the result in sonar : \n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/screenshot-uiautomator.png\" width=450px/\u003e\n\n## Espresso\n\nTo build the sample project and run the sample app on a plugged device / running emulator : \n\n```bash\n# in parent folder\nmvn clean install -P espresso\n```\n\n## Spoon from Squareup\n\n```bash\n# in parent folder\nmvn clean install -P spoon\n\n#then browse to android-sample-tests/target/spoon-output/index.html\n```\n\nHere is the result in a browser : \n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/screenshot-spoon.png\" width=450px/\u003e\n\n## Monkey testing\n\nMonkey is part of Android SDK and allows to harness Application UI and test their robustness.\nWe contributed to a new maven android plugin goal to use monkey automatically and get reports in junit format.\n\nThe results can be displayed inside sonar and will appear as normal unit tests.\n\n```bash\n# in parent folder\nmvn clean compile -P monkey\nmvn sonar:sonar -P monkey\n```\nHere is the result in sonar : \n\u003cimg src=\"https://raw.github.com/stephanenicolas/Quality-Tools-for-Android/master/gfx/screenshot-sonar-monkey.png\" width=450px/\u003e\n\n\n## Package cycles check via classycle\n\nYou will need a JDK 1.7 for this profile to work correctly.\n\n```bash\n# in parent folder\nmvn clean compile -P cycle\n```\n\nWill check package cycles (also called package tangling in Sonar) and check the build if given cycles are detected.\n[Classycle](http://classycle.sourceforge.net/) lets you define architectural constraints that can be checked automatically. \n\nDepedency definition files are very simple to edit. Here is an example : \n````\nshow allResults\n\n###define packages / groups of packages of interest\n\n## layers\n[ui] = com.octo.android.sample.ui.*\n[other] = com.octo.android.sample.* excluding [ui]\n\n###check layers integrity\ncheck [other] independentOf [ui]\n````\n## Robolectric development in eclipse\n\nRoboElectric tests are separated from the sample project, as all testing technologies. \n\nTo make this configuration work in eclipse, do the following : \n\n//TODO update this\n* after each \"maven update\" of your project, remember to configure the build path of your project, go to the last tab and *uncheck* maven dependencies so that they are not included into the final apk.\n* in your eclipse junit configuration for your project, add both \"bin/classes\" to the classpath, and set the environment variable ANDROID_HOME to the android home folder on your computer.\n* add the android jars from your maven repository to your junit run configuration in eclipse.\n\nTODO : POST a SNAPSHOT of the JUnit run config in eclipse\n\nNow, simply execute your project as a JUnit project and all robolectric tests will get executed.\n\n## Using Gradle\n\nAll gradle-related file are stored in folder `gradle`.\n\nWith Gradle 1.8+ and android gradle plugin 0.6.+ : \n\n### build the app under tests\n\n```bash\n# in parent folder\ngradle clean assemble\n```\n\n### launch the app under tests\n\n```bash\n# in parent folder\ngradle :android-sample:installDebug\n```\n\n### play standard android tests (without emma coverage): \n\n```bash\n# in parent folder\ngradle clean assembleDebug connectedInstrumentTest\n#export to sonar\ngradle :android-sample:sonarRunner\n```\n\n### play espresso tests (without emma coverage): \n\n```bash\n# in parent folder\ngradle clean assembleDebug :android-sample-espresso-tests:connectedInstrumentTest\n```\n\n### play robolectric tests : \n\n```bash\n# in parent folder\ngradle clean assembleDebug robolectric\n#export to sonar\ngradle :android-sample-robolectric-tests:sonarRunner\n```\n\n### Findbugs + Checkstyle + PMD + classycle : \n\n```bash\n# in parent folder\ngradle check\n```\n\nor independently : \n```bash\n# in parent folder\n#you need to run assemble before most of those\n#gradle assembleDebug\ngradle checkstyle\ngradle findbugs\ngradle pmd\ngradle classycle\n```\n\n### Running lint :\n```bash\n# in parent folder\ngradle :android-sample:lint\n```\n\n### Aggregate reports :\n```bash\n# in parent folder\ngradle buildDashboard\n```\n\n### TODO run test coverage using emma (standard tests): \n\n### TODO run test coverage using cobertura (robolectric tests):\n\n### TODO run test coverage using jacoco (both tests): \n\n### TODO play uiautomator tests\n\n### TODO play monkey tests\n\n### TODO play monkey runner tests\n\n### TODO shoot more stuff to sonar\n\n\n\n# Thanks to\n * [OCTO Technology](http://www.octo.com/en) to provide us with free time to work on that project.\n * Henri Treblay from [OCTO Technology](http://www.octo.com/en) for having ported [EasyMock](http://www.easymock.org/) to Android.\n * Thanks to [Jayway](http://www.jayway.com/blog) for their [Android Maven Plugin](http://code.google.com/p/maven-android-plugin/).\n * Thanks to [Sonar Source](http://www.sonarsource.org/) for supporting this effort, especially for this [project's configuration](https://github.com/SonarSource/sonar-examples/tree/master/projects/android).\n * Thanks to  Jake Wharton and Pierre-Yves Ricaud for mentionning FEST-Android.\n * Thanks to [Novoda](http://novoda.com) for their [Gradle Robolectric plugin](https://github.com/novoda/robolectric-plugin).\n * Thanks to [Seth Rylan Gainey](https://github.com/sethrylan) for his [Gradle settings](https://github.com/sethrylan/rosette).\n\n \n\n## Quality Tools for Android in the news !!\n* [Android Weekly issue #55 !] (http://androidweekly.net/#latest-issue)\n* [Android Dev Weekly, issue #49 !] (http://androiddevweekly.com/2013/03/11/Issue-49.html?utm_source=feedburner\u0026utm_medium=feed\u0026utm_campaign=Feed%3A+AndroidDevWeekly+%28%23AndroidDev+Weekly%29)\n* Our presentation at [Devoxx France 2013](https://speakerdeck.com/stephanenicolas/devoxx-2013-fr-beef-you-android-apps-using-java-tools).\n\n\nLicense\n-------\n\n Copyright (C) 2013 Stéphane Nicolas \u0026 Jérôme Van Der Linden\n\t\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\t\n\t     http://www.apache.org/licenses/LICENSE-2.0\n\t\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanenicolas%2FQuality-Tools-for-Android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephanenicolas%2FQuality-Tools-for-Android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanenicolas%2FQuality-Tools-for-Android/lists"}