Giter Club home page Giter Club logo

android-gradle-template's Introduction

Rapid start development and test

with Android Studio, Gradle, Espresso, Robolectric, AndroidAnnotations, RoboCoP, JaCoCo

Build Status & UnitTest Coverage Status

Wishes, improvements and discussions about the stuff here are welcome

Choose your favourite way

Tests in a seperated module

Switch to the branch https://github.com/nenick/android-gradle-template/tree/novoda for more informations

Tests in the same module

I'm prefer https://github.com/JCAndKSolutions/android-unit-test to support robolectric because it integrates much better through the extra created IDE Plugin.

More extended example with a clean architecture concept

https://github.com/nenick/AndroidAppDevelopment

Getting Started

Check if the project and tests works on your machine

clone, attach phone (or start emulator), run Scripts/run-tests.sh from project root

Check if you get this project to work with andorid studio

import to android studio, start development, press play

Test support in IDE

install the plugin https://github.com/evant/android-studio-unit-test-plugin you can install the plugin through the plugin installer in Android Studio

This project template support AndroidStudio.

Tests on command line

unit tests: ./gradlew testNormLDebug

  • append jacocoReport for coverage report can't be combined with the integration tests

integration tests: ./gradlew testIntegrationDebug

  • append `jacocoReport for coverage report can't be combined with the unit tests

acceptance tests: ./gradlew connectedAndroidIntegrationTest

  • replace by :App:connectedCheck for coverage report

rest example

Currently RestActivity example fails when no server is reachable.

  • start Script/start-wiremock.sh
  • kill Script/start-wiremock.sh kill

Test results

  • build/index.html (robolectric & unit tests) (should collect all reports, current is miss the some reports)
  • App/build/test-coverage-report/index.html (unit test coverage)
  • App/build/test-coverage-report/index.html (integration test coverage)
  • App/build/reports/androidTests/connected/index.html (acceptance tests)
  • App/build/reports/coverage/debug/index.html (acceptance tests coverage)

Last tests done with

  • Android Studio 1.0.2
  • Gradle Build Tools 1.0.0
  • Gradle 2.1.1

Features done

  • Gradle + AndroidStudio as development Enironment
  • Robolectric for unit tests
    • Mockito
    • Code coverage with JaCoCo
    • Code coverage with Teamcity
  • Robolectric for component tests
    • Code coverage with JaCoCo
    • Code coverage with Teamcity
  • FEST Android assertions
  • Espresso for acceptance tests
  • AndroidAnnotations generate dependency injection
  • RoboCoP generate database management
  • Shortcut: jump between test and implementation with default short cut
  • Travis CI runs all test variants
  • Coveralls shows unit test code coverage coveralls-gradle-plugin

Scripts

  • run-tests.sh execute all test variants
  • run-tests-fast.sh execute just the robolectric tests
  • run-tests-travis.sh do all steps necessary for full automatic builds, like install custom dependencies

android-gradle-template's People

Contributors

nenick avatar richardguion avatar ligi avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.