kotest-intellij-plugin icon indicating copy to clipboard operation
kotest-intellij-plugin copied to clipboard

Kotest plugin should not remove suffix () of dataTestName's result

Open xuanswe opened this issue 1 year ago • 3 comments

class KoTest : ShouldSpec({
  class Data(val expected: IntArray) : WithDataTestName {
    override fun dataTestName() =
      "result should be (${expected.joinToString()})"
  }
  context("KoTestContext(a)") {
    withData(sequence {
      yield(Data(intArrayOf()))
      yield(Data(intArrayOf(1)))
    }) {
      fail("")
    }
  }
})
class JunitTest {
  @Test
  fun `result should be ()`() {
  }

  @Test
  fun `result should be (1)`() {
  }
}

plugins {
  kotlin("jvm") version "1.9.22"
}

repositories {
  mavenCentral()
  gradlePluginPortal()
}

dependencies {
  testImplementation(kotlin("test"))

  val kotestVersion = "5.8.0"
  testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
  testImplementation("io.kotest:kotest-property:$kotestVersion")
  `testImplementation("io.kotest:kotest-framework-datatest:$kotestVersion")`
}

tasks {
  wrapper {
    gradleVersion = "8.6"
    distributionType = Wrapper.DistributionType.ALL
  }

  test {
    useJUnitPlatform()
  }
}

tasks.withType<Test>().configureEach {
  useJUnitPlatform()
}

Actual

UI shows incorrect test name KoTestContext > result should be

Gradle log prints correct test name KoTestContext(a) > result should be () FAILED

image

Expected

UI should always show correct test names in the whole hierarchy exactly as in gradle log.

In this example, it should be KoTestContext(a) > result should be ()

xuanswe avatar Mar 08 '24 15:03 xuanswe