Skip to content

Commit

Permalink
Merge pull request #1 from straburzynski/test-duration-time-in-reports
Browse files Browse the repository at this point in the history
Test duration time added for generated files.
  • Loading branch information
platan authored Oct 14, 2022
2 parents c1cb6d0 + c6ef32d commit 94dd3d6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ class TestExecutionScheduleReport {
fun add(className: String?, testName: String, startTime: Long, endTime: Long, resultType: String) {
results.add(TimedTestResult(className, testName, startTime, endTime, resultType))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ data class TimedTestResult(
var testName: String,
var startTime: Long,
var endTime: Long,
var resultType: String
)
var resultType: String,
) {
val durationMs: Long
get() = this.endTime - this.startTime
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ data class MermaidGanttDiagram(val dateFormat: String, val axisFormat: String, v
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ class TestExecutionMermaidDiagramFormatter {
fun format(report: TestExecutionScheduleReport): String {
val diagramBuilder = MermaidGanttDiagram.MermaidGanttDiagramBuilder()
report.results.forEach {
diagramBuilder.add(it.className!!, it.testName, types[it.resultType], it.startTime, it.endTime)
val testNameWithDuration = "${it.testName} - ${it.endTime.minus(it.startTime)} ms"
diagramBuilder.add(it.className!!, testNameWithDuration, types[it.resultType], it.startTime, it.endTime)
}
val diagram = diagramBuilder.build("YYYY-MM-DD\\THH\\:mm\\:ss\\.SSSZ", "%H:%M:%S.%L")
return MermaidGanttDiagramFormatter().format(diagram, "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
}
}
}

0 comments on commit 94dd3d6

Please sign in to comment.