GithubHelp home page GithubHelp logo

evan505 / incrementalcoverage Goto Github PK

View Code? Open in Web Editor NEW

This project forked from galvinchen/incrementalcoverage

0.0 0.0 0.0 919 KB

A gradle plugin for Android which can inspect incremental code test coverage

Java 100.00%

incrementalcoverage's Introduction

IncrementalCoverage

IncrementalCoverage is an Android gradle plugin which you can use it to inspect the incremental code coverage.

How to use

  1. Apply the plugin.
settings.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        jcenter()
    }
}
plugins {
    id 'com.android.application'
    id 'io.github.galvin.code-coverage' version '0.0.1'
}
  1. Define some code to generate the execution file. Such as, you can add the code when activity onDestroy, but you should guarantee that onDestroy must execute before generating coverage report. Either you can insert a Button, use it to generate the execution file. You can see the demo.
app: build.gradle

dependencies {
    compileOnly 'org.jacoco:org.jacoco.agent:0.8.4:runtime'
}
@Override
protected void onDestroy() {
    super.onDestroy();
    try {
        RT.dumpCoverageData(new File(Environment.getExternalStorageDirectory() + "/coverage.exec"), false);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
  1. Define your diff in local.properties. We use the command git diff baseline revision -U0 to get diff source lines. Actually, you should always keep the revision = "HEAD" because you may change some source files after revision. In this situation, the plugin is broken.
revision=HEAD
baseline=HEAD~1
  1. run the app, test your diff code in app.

  2. run gradle task ./gradlew generateCoverageReport to get the coverage report.

Example

incrementalcoverage's People

Contributors

galvinchen 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.