Test runner: Report ignored test suites
This commit is contained in:
committed by
Ilya Matveev
parent
beaf832413
commit
6c39516380
@@ -40,6 +40,13 @@ internal class TeamCityLogger : BaseTestLogger() {
|
||||
override fun startSuite(suite: TestSuite) = report("testSuiteStarted" +
|
||||
" name='${suite.tcName}'" +
|
||||
" locationHint='ktest:suite://${suite.tcName}'")
|
||||
|
||||
override fun ignoreSuite(suite: TestSuite) {
|
||||
startSuite(suite)
|
||||
suite.testCases.values.forEach { ignore(it) }
|
||||
finishSuite(suite, 0L)
|
||||
}
|
||||
|
||||
override fun finishSuite(suite: TestSuite, timeMillis: Long) = report("testSuiteFinished name='${suite.tcName}'")
|
||||
|
||||
override fun pass(testCase: TestCase, timeMillis: Long) = finish(testCase, timeMillis)
|
||||
|
||||
@@ -30,6 +30,7 @@ internal open class TestLoggerWithStatistics: BaseTestLogger() {
|
||||
override fun startIteration(runner: TestRunner, iteration: Int, suites: Collection<TestSuite>) = statistics.reset()
|
||||
|
||||
override fun finishSuite(suite: TestSuite, timeMillis: Long) = statistics.registerSuite()
|
||||
override fun ignoreSuite(suite: TestSuite) = statistics.registerIgnore(suite.size)
|
||||
override fun pass(testCase: TestCase, timeMillis: Long) = statistics.registerPass()
|
||||
override fun fail(testCase: TestCase, e: Throwable, timeMillis: Long) = statistics.registerFail(testCase)
|
||||
override fun ignore(testCase: TestCase) = statistics.registerIgnore()
|
||||
|
||||
@@ -26,26 +26,44 @@ internal class MutableTestStatistics: TestStatistics {
|
||||
override var totalSuites: Int = 0; private set
|
||||
|
||||
override val failed: Int
|
||||
get() = failedTests_.size
|
||||
get() = _failedTests.size
|
||||
|
||||
override val hasFailedTests: Boolean
|
||||
get() = failedTests_.isNotEmpty()
|
||||
get() = _failedTests.isNotEmpty()
|
||||
|
||||
private val failedTests_ = mutableListOf<TestCase>()
|
||||
private val _failedTests = mutableListOf<TestCase>()
|
||||
override val failedTests: Collection<TestCase>
|
||||
get() = failedTests_
|
||||
get() = _failedTests
|
||||
|
||||
fun registerSuite() { totalSuites++ }
|
||||
fun registerSuite(count: Int = 1) {
|
||||
require(count > 0)
|
||||
totalSuites += count
|
||||
}
|
||||
|
||||
fun registerPass() { total++; passed++ }
|
||||
fun registerFail(testCase: TestCase) { total++; failedTests_.add(testCase) }
|
||||
fun registerIgnore() { total++; ignored++ }
|
||||
fun registerPass(count: Int = 1) {
|
||||
require(count > 0)
|
||||
total += count
|
||||
passed += count
|
||||
}
|
||||
|
||||
fun registerFail(testCases: Collection<TestCase>) {
|
||||
total += testCases.size
|
||||
_failedTests.addAll(testCases)
|
||||
}
|
||||
|
||||
fun registerFail(testCase: TestCase) = registerFail(listOf(testCase))
|
||||
|
||||
fun registerIgnore(count: Int = 1) {
|
||||
require(count > 0)
|
||||
total += count
|
||||
ignored += count
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
total = 0
|
||||
passed = 0
|
||||
ignored = 0
|
||||
totalSuites = 0
|
||||
failedTests_.clear()
|
||||
_failedTests.clear()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user