writing test to cover RunConfigurationProducer.setupConfigurationFromContext

I have implemented a custom PantsTestRunConfigurationProducer that extends RunConfigurationProducer.setupConfigurationFromContext, essentially what it does is that when user right clicks on a piece of test code, it offers the run/debug configuration.

The question is, how can I programatically test the run/debug configuration?

How I do something programatically like:
1. import the project (already doable)
2. open up a test file in an editor
3. right click in the middle of the method definition
4. verify the configuration

Or is there better ways to cover this section the code. I tried to find usage of "RunConfigurationProducer" in intellij-community but it did not seem to appear in any test.

Comment actions Permalink

Hi Yi. Check out the documentation for Testing Plugins, then take a look at the tests in

, specifically
and its usages, for example
. The IntelliJ Platform doesn't really have support for UI testing (click here... move there), so you need to work with the underlying API. You can achieve the same result, it just takes a little bit of setup beforehand.
Comment actions Permalink

Hi Breandan,

Thanks so much for your advice. I have it implemented at https://github.com/pantsbuild/intellij-pants-plugin/commit/8d03aff680c4325fb9b26873ca62151279ce3212 for folks to refer to in the future.



Please sign in to leave a comment.