Skip to content

Commit

Permalink
Omit mergeTestTimes if used new api results
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-goral committed Mar 30, 2020
1 parent d303735 commit 9b6a68b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## next (unreleased)
- [#684](https://github.com/Flank/flank/pull/684) Add overhead time to junit test case report. ([jan-gogo](https://github.com/jan-gogo))
- [#666](https://github.com/Flank/flank/pull/666) Use API instead of XML for result parsing for android. ([jan-gogo](https://github.com/jan-gogo))
- [#678](https://github.com/Flank/flank/pull/678) Skip Bugsnag initialization if user disabled gcloud analytics. ([pawelpasterz](https://github.com/pawelpasterz))
- [#672](https://github.com/Flank/flank/pull/672) Flank timeout feature. ([pawelpasterz](https://github.com/pawelpasterz))
Expand Down
20 changes: 11 additions & 9 deletions test_runner/src/main/kotlin/ftl/reports/util/ReportManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ object ReportManager {
return matchResult?.groupValues?.last().orEmpty()
}

private fun processXmlFromFile(matrices: MatrixMap, args: IArgs, process: (file: File) -> JUnitTestResult): JUnitTestResult? {
private fun processXmlFromFile(
matrices: MatrixMap,
args: IArgs,
process: (file: File) -> JUnitTestResult
): JUnitTestResult? {
var mergedXml: JUnitTestResult? = null

findXmlFiles(matrices, args).forEach { xmlFile ->
Expand Down Expand Up @@ -132,13 +136,11 @@ object ReportManager {
newResult: JUnitTestResult,
args: IArgs,
testShardChunks: ShardChunks
):
List<ShardEfficiency> {
): List<ShardEfficiency> {
val oldDurations = Shard.createTestMethodDurationMap(oldResult, args)
val newDurations = Shard.createTestMethodDurationMap(newResult, args)

val timeList = mutableListOf<ShardEfficiency>()
testShardChunks.forEachIndexed { index, testSuite ->
return testShardChunks.mapIndexed { index, testSuite ->

var expectedTime = 0.0
var finalTime = 0.0
Expand All @@ -148,10 +150,8 @@ object ReportManager {
}

val timeDiff = (finalTime - expectedTime)
timeList.add(ShardEfficiency("Shard $index", expectedTime, finalTime, timeDiff))
ShardEfficiency("Shard $index", expectedTime, finalTime, timeDiff)
}

return timeList
}

private fun printActual(
Expand All @@ -176,7 +176,9 @@ object ReportManager {

val oldTestResult = GcStorage.downloadJunitXml(args)

newTestResult.mergeTestTimes(oldTestResult)
if (args.useLegacyJUnitResult) {
newTestResult.mergeTestTimes(oldTestResult)
}

if (oldTestResult != null) {
printActual(oldTestResult, newTestResult, args, testShardChunks)
Expand Down

0 comments on commit 9b6a68b

Please sign in to comment.