[kotlin.test] Don't run filtered out test suites by default

Popular frameworks such as JUnit, TestNG and Google Test do not
run test suites whose tests were fully filtered out. Thus
@BeforeClass/@AfterClass of such suites are not executed and the
suites are not reported in a test report.

This patch introduces the same behaviour to the Kotlin/Native's
kotlin.test runner.

See also: #4522, #4615.
This commit is contained in:
Ilya Matveev
2021-02-03 12:32:50 +07:00
committed by Vasily Levchenko
parent c866dc7303
commit 4f037b8b81
3 changed files with 119 additions and 6 deletions
@@ -0,0 +1,57 @@
package kotlin.test.tests
import kotlin.test.*
private fun hook(message: String) {
print("Hook: ")
println(message)
}
class A {
@Test
fun foo() {}
@Test
fun common() {}
@Ignore
@Test
fun ignored() {}
companion object {
@BeforeClass
fun before() = hook("A.before")
@AfterClass
fun after() = hook("A.after")
}
}
@Ignore
class Ignored {
@Test
fun bar() {}
@Test
fun common() {}
companion object {
@BeforeClass
fun before() = hook("Ignored.before")
@AfterClass
fun after() = hook("Ignored.after")
}
}
@BeforeClass
fun before() = hook("Filtered_suitesKt.before")
@AfterClass
fun after() = hook("Filtered_suitesKt.after")
@Test
fun baz() {}
@Test
fun common() {}