Skip to content

Cannot navigate to, or run, included tests #103

Open
@Mahoney

Description

@Mahoney

Not surprisingly, it's going to be hard to work out, and this is partly a note to self to try and solve, but:

Given these reusable tests:

interface Dependency
class StubbedDependency : Dependency
class RealDependency : Dependency

fun someSpecs(
  dependency: Dependency
) = stringSpec {
  "test 1" { TODO() }
  "test 2" { TODO() }
}

class UsingStubbedDependencySpecs : StringSpec({
  include(someSpecs(StubbedDependency()))
})

class UsingRealDependencySpecs : StringSpec({
  include(someSpecs(RealDependency()))
})

I cannot:

  1. Run someSpecs from the declaration fun someSpecs - there's no gutter icon
  2. Run test 2 in isolation - there's no gutter icon
  3. Navigate to the individual test declarations from the Test Results tree in the Run panel

In the equivalent JUnit scenario where you use an abstract super class, all three work; 1 & 2 offer you the options to run against either UsingStubbedDependencySpecs, or UsingRealDependencySpecs, or both, and 3 takes you to the test declaration in SomeSpecs. In:

import org.junit.jupiter.api.Test

abstract class SomeSpecs(
  dependency: Dependency
) {

  @Test
  fun `test 1`() { TODO() }

  @Test
  fun `test 2`() { TODO() }
}

class UsingStubbedDependencySpecs : SomeSpecs(StubbedDependency())

class UsingRealDependencySpecs : SomeSpecs(RealDependency())

I guess the plugin would need to read the call hierarchy to find all the classes extending *Spec where include is passed the result of function that ultimately calls stringSpec...

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions