-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(output): add test axis value column to summary table
docs(output): update summary table
- Loading branch information
Showing
13 changed files
with
128 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
test_runner/src/main/kotlin/ftl/json/SavedMatrixTableUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ftl.json | ||
|
||
import ftl.reports.outcome.TestOutcome | ||
import ftl.util.StepOutcome.failure | ||
import ftl.util.StepOutcome.flaky | ||
import ftl.util.StepOutcome.success | ||
import ftl.util.SystemOutColor | ||
import ftl.util.TableColumn | ||
import ftl.util.buildTable | ||
|
||
fun SavedMatrix.asPrintableTable(): String = listOf(this).asPrintableTable() | ||
|
||
fun List<SavedMatrix>.asPrintableTable(): String = buildTable( | ||
TableColumn( | ||
header = OUTCOME_COLUMN_HEADER, | ||
data = flatMapTestAxis { outcome }, | ||
dataColor = flatMapTestAxis { outcomeColor } | ||
), | ||
TableColumn( | ||
header = MATRIX_ID_COLUMN_HEADER, | ||
data = flatMapTestAxis { matrix -> matrix.matrixId } | ||
), | ||
TableColumn( | ||
header = TEST_AXIS_VALUE_HEADER, | ||
data = flatMapTestAxis { device } | ||
), | ||
TableColumn( | ||
header = OUTCOME_DETAILS_COLUMN_HEADER, | ||
data = flatMapTestAxis { details } | ||
) | ||
) | ||
|
||
private fun <T> List<SavedMatrix>.flatMapTestAxis(transform: TestOutcome.(SavedMatrix) -> T) = | ||
flatMap { matrix -> matrix.testAxises.map { axis -> axis.transform(matrix) } } | ||
|
||
private val TestOutcome.outcomeColor | ||
get() = when (outcome) { | ||
failure -> SystemOutColor.RED | ||
success -> SystemOutColor.GREEN | ||
flaky -> SystemOutColor.BLUE | ||
else -> SystemOutColor.DEFAULT | ||
} | ||
|
||
private const val OUTCOME_COLUMN_HEADER = "OUTCOME" | ||
private const val MATRIX_ID_COLUMN_HEADER = "MATRIX ID" | ||
private const val TEST_AXIS_VALUE_HEADER = "TEST AXIS VALUE" | ||
private const val OUTCOME_DETAILS_COLUMN_HEADER = "TEST DETAILS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
package ftl.reports.outcome | ||
|
||
import com.google.api.services.toolresults.model.Environment | ||
import com.google.api.services.toolresults.model.EnvironmentDimensionValueEntry | ||
import com.google.api.services.toolresults.model.Step | ||
import com.google.api.services.toolresults.model.StepDimensionValueEntry | ||
import ftl.environment.orUnknown | ||
|
||
internal fun Step.deviceModel() = dimensionValue["Model"] | ||
?.value.orUnknown() | ||
|
||
internal fun Environment.deviceModel() = dimensionValue["Model"] | ||
?.value.orUnknown() | ||
|
||
operator fun List<StepDimensionValueEntry>?.get(key: String) = | ||
this?.firstOrNull { it.key == key } | ||
|
||
operator fun List<EnvironmentDimensionValueEntry>?.get(key: String) = | ||
this?.firstOrNull { it.key == key } |
25 changes: 0 additions & 25 deletions
25
test_runner/src/main/kotlin/ftl/util/SavedMatrixTableUtil.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters