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

Rich DiscoveryContext API #608

Closed
raniejade opened this issue Feb 5, 2019 · 0 comments · Fixed by #609
Closed

Rich DiscoveryContext API #608

raniejade opened this issue Feb 5, 2019 · 0 comments · Fixed by #609
Milestone

Comments

@raniejade
Copy link
Member

raniejade commented Feb 5, 2019

The primary usage of this API is for discovering Test classes. Ideally it's an abstraction over platform specific Test discovery mechanisms. In JVM for example it could be backed by classgraph (we already use it in the JVM implementation for SpekRuntime). On Native (and possible JS) due to the lack of runtime reflection it's backed by compile-time generated information (via a compiler plugin but initially hand rolled). With this API we can move SpekRuntime into the common module without the need of having platform specific modules.

interface TestInfo {
    val path: Path
    fun createInstance(): Spek
}

interface DiscoveryContext {
    fun getTests(): List<TestInfo>

    companion object {
        fun builder(): DiscoveryContextBuilder
    }
}

interface DiscoveryContextBuilder {
   fun addClass(cls: KClass<out Spek>, factory: () -> Spek): DiscoveryContextBuilder
   fun build(): DiscoveryContext
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant