No issue: Add more useful test output to TaskCluster (#4165)
parent
b39afe1548
commit
e6487ba609
|
@ -9,6 +9,9 @@ apply from: "$project.rootDir/automation/gradle/versionCode.gradle"
|
||||||
apply plugin: 'androidx.navigation.safeargs.kotlin'
|
apply plugin: 'androidx.navigation.safeargs.kotlin'
|
||||||
|
|
||||||
import com.android.build.gradle.internal.tasks.AppPreBuildTask
|
import com.android.build.gradle.internal.tasks.AppPreBuildTask
|
||||||
|
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||||
|
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||||
|
import static org.gradle.api.tasks.testing.TestResult.ResultType
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
|
@ -491,4 +494,46 @@ afterEvaluate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format test output. Ported from AC #2401
|
||||||
|
tasks.matching {it instanceof Test}.all {
|
||||||
|
systemProperty "robolectric.logging", "stdout"
|
||||||
|
systemProperty "logging.test-mode", "true"
|
||||||
|
|
||||||
|
testLogging.events = []
|
||||||
|
|
||||||
|
def out = services.get(StyledTextOutputFactory).create("tests")
|
||||||
|
|
||||||
|
beforeSuite { descriptor ->
|
||||||
|
if (descriptor.getClassName() != null) {
|
||||||
|
out.style(Style.Header).println("\nSUITE: " + descriptor.getClassName())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeTest { descriptor ->
|
||||||
|
out.style(Style.Description).println(" TEST: " + descriptor.getName())
|
||||||
|
}
|
||||||
|
|
||||||
|
onOutput { descriptor, event ->
|
||||||
|
logger.lifecycle(" " + event.message.trim())
|
||||||
|
}
|
||||||
|
|
||||||
|
afterTest { descriptor, result ->
|
||||||
|
switch (result.getResultType()) {
|
||||||
|
case ResultType.SUCCESS:
|
||||||
|
out.style(Style.Success).println(" SUCCESS")
|
||||||
|
break
|
||||||
|
|
||||||
|
case ResultType.FAILURE:
|
||||||
|
out.style(Style.Failure).println(" FAILURE")
|
||||||
|
logger.lifecycle("", result.getException())
|
||||||
|
break
|
||||||
|
|
||||||
|
case ResultType.SKIPPED:
|
||||||
|
out.style(Style.Info).println(" SKIPPED")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
logger.lifecycle("")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue