com.github.ksoichiro.console.reporter.ReportTestAction.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-console-reporter Show documentation
Show all versions of gradle-console-reporter Show documentation
Gradle plugin to report various kinds of summaries to console.
package com.github.ksoichiro.console.reporter
import com.github.ksoichiro.console.reporter.parser.JUnitReportParser
import com.github.ksoichiro.console.reporter.writer.JUnitReportWriter
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskState
import org.gradle.api.tasks.testing.Test
class ReportTestAction {
public static String NAME = 'reportTest'
ConsoleReporterExtension extension
Project project
void hook(Project project) {
this.project = project
project.afterEvaluate {
extension = project.extensions."${ConsoleReporterExtension.NAME}"
if (extension.junit.enabled && extension.junit.reportOnFailure) {
project.gradle.taskGraph.afterTask { Task task, TaskState state ->
if (task instanceof Test && state.failure) {
reportJUnit([task] as Set)
}
}
}
}
}
void reportJUnit(Set testTask) {
def reports = [(project): new JUnitReportParser(testTask).parse(project, extension.junit)]
new JUnitReportWriter().write(project, reports, extension.junit)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy