Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot navigate to, or run, included tests #103

Open
Mahoney opened this issue Oct 17, 2020 · 4 comments
Open

Cannot navigate to, or run, included tests #103

Mahoney opened this issue Oct 17, 2020 · 4 comments

Comments

@Mahoney
Copy link

Mahoney commented Oct 17, 2020

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...

@sksamuel
Copy link
Member

sksamuel commented Dec 6, 2020

Yeah, it's easier for junit because it can look for subclasses - that's all it needs to do.
Kotest is more powerful, you can embed that factory test anywhere - include in other functions.

@stale
Copy link

stale bot commented Feb 4, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 4, 2021
@stale stale bot closed this as completed Feb 12, 2021
@tamj0rd2
Copy link

Any plans to work on this in the future?

@sksamuel sksamuel reopened this Jun 3, 2024
@stale stale bot removed the wontfix This will not be worked on label Jun 3, 2024
@sksamuel
Copy link
Member

sksamuel commented Jun 3, 2024

The latest release has navigation when executing individual tests/subtests.
When running full suits, still unable, due to gradle bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants