项目作者: AckeeCZ

项目描述 :
Plugin for danger-kotlin for parsing and reporting JUnit results
高级语言: Kotlin
项目地址: git://github.com/AckeeCZ/danger-kotlin-junit.git
创建时间: 2020-07-08T16:21:31Z
项目社区:https://github.com/AckeeCZ/danger-kotlin-junit

开源协议:Apache License 2.0

下载


Maven Central

danger-kotlin junit plugin

Plugin for danger-kotlin parsing and reporting JUnit results.

Installation

Put

  1. @file:DependsOn("io.github.ackeecz:danger-kotlin-junit:x.y.z")

to the top of your Dangerfile

Usage

First you need to register the plugin via

  1. register plugin JUnitPlugin

and then you can use it through its public methods

  1. JUnitPlugin.parse(junitReportFile)
  2. JUnitPlugin.report()

parse method accepts varargs of files pointing to the junit reports and parses them to internal representation.

report methods will process parsed results and reports them to pull request comments.

Example Dangerfile

  1. @file:DependsOn("io.github.ackeecz:danger-kotlin-junit:x.y.z")
  2. import io.github.ackeecz.danger.junit.JUnitPlugin
  3. import systems.danger.kotlin.danger
  4. import systems.danger.kotlin.register
  5. import java.nio.file.Files
  6. import java.nio.file.Paths
  7. import java.util.function.BiPredicate
  8. import java.util.stream.Collectors
  9. register plugin JUnitPlugin
  10. danger(args) {
  11. val junitReports = Files.find(Paths.get(""), 10, BiPredicate { path, _ ->
  12. val fileName = path.toFile().name
  13. fileName.startsWith("TEST") && fileName.endsWith("xml")
  14. }).map { it.toFile() }.collect(Collectors.toList())
  15. JUnitPlugin.parse(*junitFiles.toTypedArray())
  16. JUnitPlugin.report()
  17. }

This will find all files in the depth of 10 relative to current directory that matches the junit report files naming,
and it will pass them to the plugin for processing.