How to automate testing for IDEA plugins (TravisCI specifically)

Hello,


Is there any way to automate testing of IDEA plugins using TravisCI, or any other method?
I'd like to setup this for the existing GOlang plugin and I guess others could benefit from it as well.
In case I've missed something on the docs please let me know.

So far I've created a script to download the latest IDEA 13 Community verison but I have no clue on how to properly launch it, the docs could use some improvements:
'-ea -Xbootclasspath/p:../out/classes/production/boot -XX:+HeapDumpOnOutOfMemoryError -Xmx512m -XX:MaxPermSize=320m -Didea.system.path=../test-system -Didea.home.path=../ -Didea.config.path=../test-config -Didea.test.group=ALL_EXCLUDE_DEFINED' is not really helpful, sorry.

Thank you for your help.


Kind regards,
Florin

11 comments
Comment actions Permalink

Sorry, we don't have specific docs for setting up such an environment.

Maybe this topic has some hints http://devnet.jetbrains.com/message/5488124

0
Comment actions Permalink

Hi Yann,


Thanks for the reply.
Unfortunately that doesn't help me too much either.
Since I don't suppose you guys want to share you are running your CI environment for plugins (and I guess you are not using TravisCI), would it be cool if I submit a ticket in YouTrack for this?

Alternatively, a tutotrial for how to do it with TeamCity would be good as well. A hosted TeamCity service for plugins only would be really nice from JetBrains (if I'm not asking too much).

Thanks.

0
Comment actions Permalink

I don't understand the current problem(s) you're facing.
IMHO having a downloaded/shared repo containing necessary IJ JAR files "somewhere" should work fine to compile your plugin and execute your plugin's tests by using those IJ JARs on the compile/test classpath.
(how to do this of course depends on your plugin project's build system and CI server)

0
Comment actions Permalink

I think the problem is that it's not immediately obvious how to run tests - I couldn't get it going using the doc here: http://confluence.jetbrains.com/display/IntelliJIDEA/Tests+Prerequisites. It's cryptic, to say the least.

Here's how I do it. I don't have my plugin configured as a plugin module, it's just a normal IntelliJ module. I have a lib directory in my source root, and I copy an IntelliJ installation under there with a name like IntelliJ12SDK or similar. I gitignore that, of course. I'm on a Mac, so cp -r /Applications/IntelliJ\ IDEA\ 13\ CE.app/ lib/IntelliJ13SDK. I compile the same version of the community sources and copy out/artifacts/sources.zip under there too. I then set up a library called IntelliJ which references everything from IntelliJ13SDK/lib and uses the sources.zip.

Since I'm not using a plugin module type, I have to build the plugin myself, I do that with an artifact following the layout here: http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Plugin+Structure


I can then run the IDE with my plugin installed by using a normal application run config invoking com.intellij.idea.Main and a working directory of lib/IntelliJ12SDK/bin. It needs some system properties apart from the usual: -Didea.system.path=../clojure-system -Didea.config.path=../clojure-config -Dplugin.path=<MY_PROJECT>/out/artifacts/<MY_ARTIFACT_NAME> -Didea.ProcessCanceledException=disabled. The classpath is a little tricky here - I use a separate runner module which has a dependency on my main plugin module in provided scope, and a dependency on the IntelliJ library detailed above in compile scope - the run config should use this runner module, not the main plugin module. Make sure you build the artifact in a before run step.

I can now run JUnit tests pretty much normally using my project directory as my working directory, I just have to add the system property -Dplugin.path=<MY_PROJECT>/out/artifacts/<MY_ARTIFACT_NAME> as above and it all works nicely. The JUnit run config uses the main plugin module. You should be able to replicate the setup above on your build server and you'll be good to go. Again, remember to build the artifact in a before run step. Even if you're building your plugin jar using some other method (I use ant when I release) the above should work, just point plugin.path to your jar and I think it should work.

I inherited this structure from the La Clojure plugin and I think the Scala one does the same thing - there's a little bit of setup but it works well for me now, and it should be easy to replicate in a CI environment.

0
Comment actions Permalink

Colin thanks a lot for the reply.

I'll try something based on it.

0
Comment actions Permalink

Sure, let me know if you have any issues. One thing I forgot to mention - since I add IntelliJ as a library explicitly I don't need to use an IntelliJ SDK, just a standard 1.6 Java SDK works fine (in fact, an IntelliJ one will conflict).

0
Comment actions Permalink

I've got it running this far: https://github.com/mtoader/google-go-lang-idea-plugin/pull/322 but right now I"m clueless into how to make it work.
It seems that I'm not loading the IntelliJ classes when running JUnit but I have no idea how to do it.
Any help would be greatly appreciated.


Thank you.

0
Comment actions Permalink

Your tests are run using classpath.test, which doesn't seem to include the idea-IC jar classes anywhere, it only includes the JUnit jar.

0
Comment actions Permalink

Yann, I think I've did that but unfortunately my knowledge on how to properly setup ANT stops here.
If you could please have a look on this one: https://travis-ci.org/dlsniper/google-go-lang-idea-plugin/builds/15139913 it would be great.
Thank you very much to you and Colin Fleming for the support so far.


Kind regards,
Florin

0
Comment actions Permalink

Yann we've finally managed to get around and add automatic testing for our plugin.
Maybe it would be useful for others if the docs could link on how we did it: https://github.com/go-lang-plugin-org/go-lang-idea-plugin/blob/master/travis.sh
It might not be the best idea to download the sources of IDEA IC everytime but improvements are welcomed ;)


Kind regards,
Florin

0

Please sign in to leave a comment.