Tweaked performance-tests stats output

This commit is contained in:
Vladimir Dolzhenko
2020-06-07 23:02:38 +02:00
parent 8216e5cd72
commit 19855c5bd5
2 changed files with 12 additions and 12 deletions
@@ -77,10 +77,8 @@ class Stats(
val shortName = if (perfCounterName.endsWith(": time")) n.removeSuffix(": time") else null
shortName?.let {
TeamCity.test(it, durationMs = mean, includeStats = false) {
TeamCity.statValue(it, mean)
}
TeamCity.test(shortName, durationMs = mean) {
TeamCity.statValue(n, mean)
}
}
@@ -172,7 +170,7 @@ class Stats(
"$testName stability is $stabilityPercentage %, above accepted level of $acceptanceStabilityLevel %"
}
TeamCity.test(stabilityName, errorDetails = error) {
TeamCity.test(stabilityName, errorDetails = error, includeStats = false) {
TeamCity.statValue(stabilityName, stabilityPercentage)
}
}
@@ -42,16 +42,18 @@ object TeamCity {
test(name, durationMs, errorDetails = if (errors.isNotEmpty()) toDetails(errors) else null, block = block)
}
fun test(name: String, durationMs: Long? = null, includeStats: Boolean = true, errorDetails: String? = null, block: () -> Unit) {
testStarted(name)
fun test(name: String?, durationMs: Long? = null, includeStats: Boolean = true, errorDetails: String? = null, block: () -> Unit) {
name?.let { testStarted(it) }
try {
block()
} finally {
if (includeStats) statValue(name, durationMs ?: -1)
if (errorDetails != null) {
testFailed(name, errorDetails)
} else {
testFinished(name, durationMs)
name?.let {
if (includeStats) statValue(it, durationMs ?: -1)
if (errorDetails != null) {
testFailed(it, errorDetails)
} else {
testFinished(it, durationMs)
}
}
}
}