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

Provide infrastructure for writing IDE and build tools plugin #32

Closed
raniejade opened this issue Apr 30, 2016 · 13 comments
Closed

Provide infrastructure for writing IDE and build tools plugin #32

raniejade opened this issue Apr 30, 2016 · 13 comments
Assignees
Milestone

Comments

@raniejade
Copy link
Owner

Problem

Currently the only way to get IDE and build tools support is via JUnitKSpecRunner. This approach is very limited as you cant run a specific spec.

Possible solutions

  1. JUnit 5 looks promising, especially the test-engine-api and the launcher. If all goes well with it, we don't even need to write any plugins (someone may already did).
  2. Write a custom test engine for KSpec. Currently exploring it, you can checkout this branch.
@jasonm23
Copy link

jasonm23 commented May 1, 2016

  1. Ideally it should allow IntelliJ to run/debug on single blocks (describe; context; it)

  2. Personally having a lot of recent experience with RSpec having a command line runner that works at the context/block nearest a given line number is very useful too.

    For example run the spec context nearest line 62 of SomeFeatureSpec

    kspec src/test/org/example/SomeFeatureSpec.kt:62
    

2 would be a "nice to have", but not essential. If implementing is an easy win, then great! (Of course this is also off topic for IntelliJ integration, so it's just noted here as an idea.)

@raniejade
Copy link
Owner Author

1 is the plan, already have a gist on the approach that I will take but haven't started it yet. A console runner would be great but it will be low priority. When all the plugins is done, writing the console runner will be easy.

@jasonm23
Copy link

jasonm23 commented May 1, 2016

Good news

@raniejade
Copy link
Owner Author

raniejade commented May 7, 2016

Just realised that writing the console runner will make writing IDE plugin much more easier, so I will be prioritising it. The runner will just be bare, just enough that I can use it to write the IDE plugins.

@jasonm23
Copy link

jasonm23 commented May 7, 2016 via email

@raniejade
Copy link
Owner Author

Yes, just started writing the console runner hopefully I can have something after this weekend.

@jasonm23
Copy link

jasonm23 commented May 7, 2016 via email

@raniejade
Copy link
Owner Author

For running specific example groups and/or examples, I'll be implementing something similar to an XPath query.

Examples:

  • describe: Foo/it: bar
  • /com.example.SampleSpec/context: group/*

@jasonm23
Copy link

jasonm23 commented May 7, 2016

I'd think it would be better to use the line number, and then run the enclosing spec / context for that line.

By way of explanation, it descriptions are generally more verbose than is convenient to retype, as is the full context path to a spec.

Of course whatever you give users going to help, I just wanted to throw in a thought.

On 7 May 2016, at 7:31 PM, Ranie Jade Ramiso notifications@github.com wrote:

For running specific example groups and/or examples, I'll be implementing something similar to an XPath query.

Examples:

describe: Foo/it: bar
/com.example.SampleSpec/context: group/*

You are receiving this because you commented.
Reply to this email directly or view it on GitHub

@raniejade
Copy link
Owner Author

It will be a bit tricky to implement right now, but it will definitely happen. For now I just want something that can be used with IDE plugins.

@jasonm23
Copy link

jasonm23 commented May 7, 2016 via email

@raniejade
Copy link
Owner Author

@jasonm23 I'll be landing #33 soon and work on the IntelliJ plugin. A console runner is included in the PR, you probably want to check it out. Planning to publish the runner via sdkman, for now just build from source.

./gradlew kspec-console-runner:distZip

The runner will be found under kspec-console-runner/build/distributions.

Sample usage:

kspec -s com/example/SampleSpec.kt --cp <classpath> -q "describe: foo/it: bar"

The runner is very simple and probably still have some bugs. Size is around ~20mb because of the kotlin-compiler.

@jasonm23
Copy link

jasonm23 commented May 9, 2016 via email

@raniejade raniejade self-assigned this May 9, 2016
raniejade added a commit that referenced this issue May 9, 2016
Resolves #32.

Broken down kspec-core into several modules.

kspec-core - core classes.
kspec-engine - defines the runtime behaviour of KSpec.
kspec-launcher - provides infrastructure in writing IDE and build tool plugins.
kspec-console-runner - console runner for KSpec (uses kspec-launcher).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants