All Projects → ksoichiro → gradle-console-reporter

ksoichiro / gradle-console-reporter

Licence: Apache-2.0 License
Gradle plugin to report various kinds of summaries to console.

Programming Languages

groovy
2714 projects

Projects that are alternatives of or similar to gradle-console-reporter

sphinx-gradle-plugin
Sphinx site generation plugin for Gradle
Stars: ✭ 19 (-61.22%)
Mutual labels:  gradle, gradle-plugin
gradle-libraries-plugin
No description or website provided.
Stars: ✭ 29 (-40.82%)
Mutual labels:  gradle, gradle-plugin
EasyUtAndroid
Android unit testing example 全面的android应用单元测试方法及案例
Stars: ✭ 21 (-57.14%)
Mutual labels:  junit, jacoco
kotlin-plugin-generated
A Kotlin compiler plugin that annotates Kotlin-generated methods for improved coverage reports
Stars: ✭ 33 (-32.65%)
Mutual labels:  gradle-plugin, jacoco
sonatype-publish-plugin
Gradle Plugin for publishing artifacts to Sonatype and Nexus
Stars: ✭ 17 (-65.31%)
Mutual labels:  gradle, gradle-plugin
jacoco-report
Github action that publishes the JaCoCo report as a comment in the Pull Request
Stars: ✭ 31 (-36.73%)
Mutual labels:  reporting, jacoco
gradle-build-info-plugin
Gradle plugin to include build information such as Git commit ID to your JAR. It can be used to show Git commit information with Spring Boot Actuator.
Stars: ✭ 33 (-32.65%)
Mutual labels:  gradle, gradle-plugin
jacoco-gradle-testkit-plugin
Gradle plugin for JaCoCo code coverage in tests using Gradle TestKit
Stars: ✭ 37 (-24.49%)
Mutual labels:  gradle-plugin, jacoco
SetupBuilder
Gradle plugin for building setups for different platforms.
Stars: ✭ 75 (+53.06%)
Mutual labels:  gradle, gradle-plugin
gradle-helm-plugin
A Gradle plugin for building, publishing and managing Helm charts.
Stars: ✭ 42 (-14.29%)
Mutual labels:  gradle, gradle-plugin
allure-gradle
Allure Gradle Plugin
Stars: ✭ 62 (+26.53%)
Mutual labels:  reporting, gradle-plugin
plugin-yml
A Gradle plugin that generates plugin.yml for Bukkit/BungeeCord/Nukkit plugins based on the Gradle project
Stars: ✭ 42 (-14.29%)
Mutual labels:  gradle, gradle-plugin
scalatest-junit-runner
JUnit 5 runner for Scalatest
Stars: ✭ 30 (-38.78%)
Mutual labels:  gradle-plugin, junit
gradle-cleaner-intellij-plugin
Force clear delaying & no longer needed Gradle tasks.
Stars: ✭ 26 (-46.94%)
Mutual labels:  gradle, gradle-plugin
travis-ci-tutorial-java
Just to learn how to use travis-ci in a java project!
Stars: ✭ 38 (-22.45%)
Mutual labels:  junit, jacoco
gradle-localization-plugin
Gradle plugin for automating the download process of localization files.
Stars: ✭ 19 (-61.22%)
Mutual labels:  gradle, gradle-plugin
Gradle Testsets Plugin
A plugin for the Gradle build system that allows specifying test sets (like integration or acceptance tests).
Stars: ✭ 182 (+271.43%)
Mutual labels:  gradle, gradle-plugin
Badass Jlink Plugin
Create a custom runtime image of your modular application
Stars: ✭ 216 (+340.82%)
Mutual labels:  gradle, gradle-plugin
gatling-gradle-plugin-demo
Showcase of the Gatling Plugin for Gradle
Stars: ✭ 17 (-65.31%)
Mutual labels:  gradle, gradle-plugin
RocketXPlugin
🔥🔥 android 端编译加速插件🚀 自动识别未改动 module 并在编译流程中替换为 aar ,只编译改动模块,加速 Android apk 的编译速度。
Stars: ✭ 408 (+732.65%)
Mutual labels:  gradle, gradle-plugin

gradle-console-reporter

Build Status Build status Coverage Stagus

Gradle plugin to report various kinds of summaries to console.

This plugin will aggregate test reports and show them to console.
It's useful when you use CI services that don't save artifacts.

Available reports

  • JUnit test report
  • JaCoCo coverage report
  • Cobertura coverage report

Usage

Getting started

Just apply the plugin in your build.gradle.

plugins {
    id 'com.github.ksoichiro.console.reporter' version '0.6.3'
}

Or

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.github.ksoichiro:gradle-console-reporter:0.6.3'
    }
}

apply plugin: 'com.github.ksoichiro.console.reporter'

Test report

When your tests fail, the plugin would print test failure details to the console.

$ ./gradlew test
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test

com.example.ATest > greet3 FAILED
    org.junit.ComparisonFailure at ATest.java:31

com.example.ATest > greet FAILED
    org.junit.ComparisonFailure at ATest.java:19

com.example.BTest > greet FAILED
    org.junit.ComparisonFailure at BTest.java:18

5 tests completed, 3 failed
:test FAILED
testsuite com.example.ATest:
  stdout:
    debug log in test2
    debug log
    debug log
    debug log in test
    debug log
  stderr:
    debug error log in test3
  testcase com.example.ATest > greet3: org.junit.ComparisonFailure: expected:<Hello[.]> but was:<Hello[]>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at com.example.ATest.greet3(ATest.java:31)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ...
	at java.lang.Thread.run(Thread.java:745)

  testcase com.example.ATest > greet: org.junit.ComparisonFailure: expected:<Hello[!]> but was:<Hello[]>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at com.example.ATest.greet(ATest.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ...
	at java.lang.Thread.run(Thread.java:745)

testsuite com.example.BTest:
  testcase com.example.BTest > greet: org.junit.ComparisonFailure: expected:<Bye[!]> but was:<Bye[]>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at com.example.BTest.greet(BTest.java:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ...
	at java.lang.Thread.run(Thread.java:745)
...

You can suppress stacktrace by configuring the plugin.
See configurations section for details.

JaCoCo coverage report

If you're using JaCoCo gradle plugin, you can see the coverage at the end of builds:

$ ./gradlew check

Coverage summary:
project1:                 72.2%
project2-with-long-name:   4.0%

BUILD SUCCESSFUL in 0s
9 actionable tasks: 1 executed, 8 up-to-date

Cobertura coverage report

If you're using stevesaliman/gradle-cobertura-plugin, you can see the coverage at the end of builds:

$ ./gradlew cobertura check

> Task :instrument
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file

> Task :test
log4j:WARN No appenders could be found for logger (net.sourceforge.cobertura.coveragedata.TouchCollector).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

> Task :generateCoberturaReport
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 198ms
Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Report time: 71ms

Coverage summary:
cobertura:  71.4%

BUILD SUCCESSFUL in 3s
7 actionable tasks: 7 executed

Tasks

reportTest

Print JUnit test report.
This task will be executed automatically after test task's failure by default, so you don't need to call it.

reportJacoco

Print JaCoCo coverage report.
This task will be executed automatically after jacocoTestReport task by default, so you don't need to call it.

reportCobertura

Print Cobertura coverage report.
This task will be executed automatically after cobertura task by default, so you don't need to call it.

Configurations

consoleReporter {
    junit {
        // Set this property to false if you don't need JUnit report.
        // Default is true.
        enabled true

        // Set this property to false if you want to see console report always.
        // Default is true.
        reportOnFailure true

        // Set this property to true if you want to see test summary.
        // Default is false.
        summaryEnabled true

        // Set this property to true if you want to see standard output.
        // Default is false.
        stdoutEnabled true

        // Set this property to true if you want to see standard error.
        // Default is false.
        stderrEnabled true

        // Set this property to false if you don't need stacktrace.
        // Default is true.
        stacktraceEnabled true

        // Set this property to false if you don't need colorized output.
        // Default is true.
        colorEnabled true

        // Set this property to false if you don't need source code between stacktrace.
        // Default is true.
        partialSourceInsertionEnabled true
    }

    jacoco {
        // Set this property to false if you don't need JaCoCo report.
        // Default is true.
        // Even if this is true, reporting will not work
        // without applying jacoco plugin.
        enabled true

        // Set this property to false if you want to see console report always.
        onlyWhenCoverageTaskExecuted true

        // Set this property to false if you want to see console report
        // just after each project's jacocoTestReport task.
        // If set to true, all reports will be shown at the end of builds.
        // Default is true.
        reportAfterBuildFinished true

        // Set this property to true if you want to treat a lack of the minimum coverage as an build error.
        // This property sees thresholdError property, and if the coverage has fallen below this value
        // the plugin will throw an exception to cause a build error.
        // Default is false.
        // If you set this to true, you should also set thresholdError property.
        failIfLessThanThresholdError false

        // Set this property to false if you don't like this plugin automatically changing some
        // property of jacoco plugin.
        // If this is set to true, the plugin will set some properties of jacoco plugin
        // to calculate coverage.
        // Default is true.
        autoconfigureCoverageConfig true

        // Set this property to your custom JacocoReport type task name, if you need.
        // Default is 'jacocoTestReport'.
        coverageTaskName 'jacocoTestReport'

        // Set this property to your JaCoCo report XML file.
        // Default is null, which means
        // ${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml
        // will be parsed.
        reportFile

        // Set this property to a certain C0 coverage percentage.
        // When the coverage is greater than or equals to this value,
        // the coverage will be shown with green color.
        // Default is 90.
        thresholdFine 90

        // Set this property to a certain C0 coverage percentage.
        // When the coverage is greater than or equals to this value,
        // the coverage will be shown with yellow color.
        // (When the coverage is less than this value, result will be red.)
        // Default is 70.
        thresholdWarning 70

        // Set this property to a certain C0 coverage percentage.
        // When the coverage is less than this value and
        // failIfLessThanThresholdError property is set to true,
        // the build will fail.
        // Default is 0.
        thresholdError 0

        // Set this property if you want to customize build error message
        // when you use 'failIfLessThanThresholdError' feature.
        brokenCoverageErrorMessage "Coverage has fallen below the threshold in some projects."

        // Set this property to false if you don't need colorized output.
        // Default is true.
        colorEnabled true
    }

    cobertura {
        // Set this property to false if you don't need Cobertura report.
        // Default is true.
        // Even if this is true, reporting will not work
        // without applying stevesaliman/gradle-cobertura-plugin plugin.
        enabled true

        // Set this property to false if you want to see console report always.
        onlyWhenCoverageTaskExecuted true

        // Set this property to false if you want to see console report
        // just after each project's cobertura task.
        // If set to true, all reports will be shown at the end of builds.
        // Default is true.
        reportAfterBuildFinished true

        // Set this property to true if you want to treat a lack of the minimum coverage as an build error.
        // This property sees thresholdError property, and if the coverage has fallen below this value
        // the plugin will throw an exception to cause a build error.
        // Default is false.
        // If you set this to true, you should also set thresholdError property.
        failIfLessThanThresholdError false

        // Set this property to false if you don't like this plugin automatically changing some
        // property of cobertura plugin.
        // If this is set to true, the plugin will set some properties of cobertura plugin
        // to calculate coverage.
        // Default is true.
        autoconfigureCoverageConfig true

        // Set this property to your custom cobertura task name, if you need.
        // Default is 'generateCoberturaReport'.
        coverageTaskName 'generateCoberturaReport'

        // Set this property to your Cobertura report XML file.
        // Default is null, which means
        // ${project.buildDir}/reports/cobertura/coverage.xml
        // will be parsed.
        reportFile

        // Set this property to a certain C0 coverage percentage.
        // When the coverage is greater than or equals to this value,
        // the coverage will be shown with green color.
        // Default is 90.
        thresholdFine 90

        // Set this property to a certain C0 coverage percentage.
        // When the coverage is greater than or equals to this value,
        // the coverage will be shown with yellow color.
        // (When the coverage is less than this value, result will be red.)
        // Default is 70.
        thresholdWarning 70

        // Set this property to a certain C0 coverage percentage.
        // When the coverage is less than this value and
        // failIfLessThanThresholdError property is set to true,
        // the build will fail.
        // Default is 0.
        thresholdError 0

        // Set this property if you want to customize build error message
        // when you use 'failIfLessThanThresholdError' feature.
        brokenCoverageErrorMessage "Coverage has fallen below the threshold in some projects."

        // Set this property to false if you don't need colorized output.
        // Default is true.
        colorEnabled true
    }
}

License

Copyright 2015 Soichiro Kashima

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].