diff --git a/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt b/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt index a03fdc19e0..800c448b5b 100644 --- a/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt +++ b/test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt @@ -14,7 +14,6 @@ import ftl.util.StepOutcome.failure import ftl.util.StepOutcome.inconclusive import ftl.util.StepOutcome.skipped import ftl.util.StepOutcome.success -import ftl.util.StepOutcome.unset import ftl.util.webLink // execution gcs paths aren't API accessible. @@ -87,7 +86,13 @@ class SavedMatrix(matrix: TestMatrix) { } private fun updateFinishedMatrixData(matrix: TestMatrix) { - matrix.testExecutions.createTestExecutionDataListAsync() + val testExecutionData = matrix.testExecutions.createTestExecutionDataListAsync() + val initial = TestSuiteOverviewData(0, 0, 0, 0, 0, 0.0, 0.0) + // details + val summedTestSuiteOverviewData = + testExecutionData.prepareForJUnitResult().fold(initial) { sum, test -> sum + test.createTestSuitOverviewData() } + + testExecutionData .prepareForJUnitResult() .forEach { updatedFinishedInfo( @@ -96,11 +101,27 @@ class SavedMatrix(matrix: TestMatrix) { it.testExecution.environment.androidDevice, matrix.projectId.orEmpty() ), - testSuiteOverviewData = it.createTestSuitOverviewData(), + testSuiteOverviewData = summedTestSuiteOverviewData, billableMinutes = it.step.testExecutionStep?.testTiming?.testProcessDuration?.seconds ?.let { testTimeSeconds -> Billing.billableMinutes(testTimeSeconds) } ) } + + // old method +/* data + .prepareForJUnitResult() + .forEach { + updatedFinishedInfo( + stepOutcome = GcToolResults.getExecutionResult(it.testExecution).outcome, + isVirtualDevice = AndroidCatalog.isVirtualDevice( + it.testExecution.environment.androidDevice, + matrix.projectId.orEmpty() + ), + testSuiteOverviewData = it.createTestSuitOverviewData(), + billableMinutes = it.step.testExecutionStep?.testTiming?.testProcessDuration?.seconds + ?.let { testTimeSeconds -> Billing.billableMinutes(testTimeSeconds) } + ) + }*/ } private fun updatedFinishedInfo( diff --git a/test_runner/src/main/kotlin/ftl/reports/api/data/TestSuiteOverviewData.kt b/test_runner/src/main/kotlin/ftl/reports/api/data/TestSuiteOverviewData.kt index 961cebab9c..b7c656bece 100644 --- a/test_runner/src/main/kotlin/ftl/reports/api/data/TestSuiteOverviewData.kt +++ b/test_runner/src/main/kotlin/ftl/reports/api/data/TestSuiteOverviewData.kt @@ -8,4 +8,15 @@ data class TestSuiteOverviewData( val skipped: Int, val elapsedTime: Double, val overheadTime: Double -) +) { + operator fun plus(nextData: TestSuiteOverviewData?) = + if (nextData == null) this else copy( + total = this.total + nextData.total, + errors = this.errors + nextData.errors, + failures = this.failures + nextData.failures, + flakes = this.flakes + nextData.flakes, + skipped = this.skipped + nextData.skipped, + elapsedTime = this.elapsedTime + nextData.elapsedTime, + overheadTime = this.overheadTime + nextData.overheadTime + ) +}