Skip to content

Commit

Permalink
#829 Display outcome details based on shards sum
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Adamczyk committed Jul 2, 2020
1 parent 8102b71 commit 1949804
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
27 changes: 24 additions & 3 deletions test_runner/src/main/kotlin/ftl/json/SavedMatrix.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

0 comments on commit 1949804

Please sign in to comment.