amatkivskiy / AndroidTDDBootStrap

A bootstrap project for TDD Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android TDD bootstrap project

Master branch build status codecov.io Android Arsenal

An Android TDD bootstrap project, use a collection of new technology, obey best practices, inspired from some popular architectures, develop with many handy tools.

Why another bootstrap project?

From the beginning of this year 2015, our team start a new project, and before we develop functionality in detail, we try to create a well-architecture project from scratch, with well designed network layer, data layer, asynchronous execution, communication between modules, and last but not least: unit test and integrate test support. After several months of developing, we found some drawback of our current architecture, and also found some popular architectures, then I decide to extract our original well designed architecture and open source it, with amendment according to the drawback and features from new popular architectures we found. Recently I have seen a lot of bootstrap/base Android project, including JakeWharton's u2020, mobiwiseco's Android-Base-Project, etc, but none of these projects cover all features I include in this AndroidTDDBootStrap project. That's why I want more people to see this repo, and I also want get feedback from more people to improve this project.

Architecture

Based on the project architecture I'm currently work on, YOLO, and inspired from popular architectures: Android Clean Architecture, Against Android Unit Tests: The Square way.

  • MVP: Mosby, A Model-View-Presenter library for modern Android apps.
  • Dependency injection
  • Dagger2, A fast dependency injector for Android and Java.
  • ButterKnife, View "injection" library for Android.
  • Data layer
  • StorIO, Beautiful API for SQLiteDatabase and ContentResolver.
  • Auto-parcel, Port of Google AutoValue for Android with Parcelable generation goodies.
  • Network layer
  • Retrofit, Type-safe HTTP client for Android and Java by Square, Inc.
  • OkHttp, An HTTP+SPDY client for Android and Java applications.
  • Gson, A Java library that can be used to convert Java Objects into their JSON representation.
  • Asynchronous execution: RxAndroid, RxJava bindings for Android.
  • Communication between modules: EventBus, Android optimized event bus that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
  • Image loader: Fresco, An Android library for managing images and the memory they use.
  • Iconfy, Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
  • Developer tools
  • XLog, Method call logging based on dexposed.
  • Android Lint Summary, View your Android lint issues with style.
  • LeakCanary, A memory leak detection library for Android and Java.
  • ThreeTenABP, An adaptation of the JSR-310 backport for Android.
  • FragmentArgs, Annotation Processor for setting arguments in android fragments.
  • fabric, Crash report.
  • retrolambda, Backport of Java 8's lambda expressions to Java 7, 6 and 5.
  • Timber, A logger with a small, extensible API which provides utility on top of Android's normal Log class.
  • Codestyle, Customized base on Square java-code-styles.
  • Android Unmock Gradle Plugin, Gradle plugin to be used in combination with the new unit testing feature of the Gradle Plugin / Android Studio to use real classes for e.g. SparseArray.
  • Unit test
  • Junit && Android Junit && Robolectric(Only used for submodule 'once')
  • Following the Square Way
  • Integrate test
  • Espresso
  • Continuous integration
  • Travis CI
  • Code quality, customized from Vincent Brison's vb-android-app-quality repo
  • AndroidCodeQualityConfig
  • Checkstyle, Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
  • Find bugs, FindBugs is a defect detection tool for Java that uses static analysis to look for more than 200 bug patterns, such as null pointer dereferences, infinite recursive loops, bad uses of the Java libraries and deadlocks.
  • PMD, PMD is a source code analyzer.
  • Lint, Android Lint Summary, View your Android lint issues with style.
  • Code coverage
  • Jacoco & Codecov
  • Kotlin, Statically typed programming language for the JVM, Android and the browser.

Project structure

  • common
  • Pure java library, provide common functionality.
  • common-android
  • Android library, provide common functionality.
  • model
  • Android library, define network API, data object, DAO...
  • presentation
  • Android application, app functionality.
  • package organization
  • package by layer v.s. package by feature, read more about the Package organization part of this blog, and Package by feature, not layer.
  • package by layer + package by feature + network API, data object, DAO are organized in the single model library module + common utils and base code are organized together + app functionality are organized by feature, mvp, di, ui code are organized together

Build tips

  • Sign key config

    Place KeyStore file in some place, and create a TemplateKeyStore.properties, and config the KeyStore in it, include keystore, keystore.password, key.password, key.alias.

  • To clone all submodules, please use git clone --recursive git@github.com:Piasy/AndroidTDDBootStrap.git

Dev tips

  • Create utils
  • Create util class in common/common-android module
  • Add @Provides annotated provider method in corresponding Module class(UtilsModule.java/AndroidUtilsModule.java)
  • Add expose method in AppComponent.java
  • Create Activity
  • Unit test
  • use the check*.sh script in buildsystem dir
  • Run ./buildsystem/ci.sh before git push.

Todo

  • CheckStyle
  • re-arch the provider package
  • Espresso test of presentation module
  • re-arch AppComponent
  • facebook BUCK integration integrate with OkBuck
  • Update dependencies
  • NDK integrate
  • MVP source generator
  • MVVM branch
  • react native branch
  • kotlin branch

Coverage

codecov.io

Acknowledgement

  • Thanks for our team, YOLO.
  • Thanks for my colleague & mentor, promeG.

About

A bootstrap project for TDD Android.

License:MIT License


Languages

Language:Java 99.7%Language:Shell 0.3%