在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ksoichiro/gradle-console-reporter开源软件地址(OpenSource Url):https://github.com/ksoichiro/gradle-console-reporter开源编程语言(OpenSource Language):Groovy 100.0%开源软件介绍(OpenSource Introduction):gradle-console-reporter
This plugin will aggregate test reports and show them to console. Available reports
UsageGetting startedJust 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 reportWhen 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. JaCoCo coverage reportIf 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 reportIf 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 TasksreportTestPrint JUnit test report. reportJacocoPrint JaCoCo coverage report. reportCoberturaPrint Cobertura coverage report. ConfigurationsconsoleReporter {
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
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论