com.malinskiy.marathon.execution.TestResult.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Cross-platform test runner
package com.malinskiy.marathon.execution
import com.malinskiy.marathon.device.DeviceInfo
import com.malinskiy.marathon.test.Test
data class TestResult(
val test: Test,
val device: DeviceInfo,
val status: TestStatus,
val startTime: Long,
val endTime: Long,
val stacktrace: String? = null,
val attachments: List = emptyList()
) {
fun durationMillis() = endTime - startTime
val isIgnored: Boolean
get() = when (status) {
TestStatus.IGNORED, TestStatus.ASSUMPTION_FAILURE -> true
else -> false
}
val isSuccess: Boolean
get() = when (status) {
TestStatus.PASSED -> true
else -> false
}
val isTimeInfoAvailable = startTime != 0L && endTime != 0L
override fun toString(): String {
return "TestResult(test=${test}, " +
"device=${device}, status=${status}, " +
"startTime=${startTime}, endTime=${endTime}, " +
"stacktrace=${stacktrace?.take(24)})"
}
}