Quantcast
Channel: JetBrains Developer Community : All Content - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5481

Plugin to set default Run/Debug settings

$
0
0

I'm relatively new to IntelliJ, and one time consumer for me has been the setting of run/debug defaults, particularly the environment and vm options sections.

 

At our shop we have basically 3 types of tests.  Unit tests with no outside dependencies. These tests have a single environment option and no special vm options in order to pass successfully.  When we run from gradle, these are set automatically, within Idea we need to set them manually.

 

Our integration tests have outside dependencies that require 4 environment elements and a fairly complex vm options.  In order to make sure unit tests stay pure, I do NOT want these options set when running unit tests.

 

Our end to end tests have yet another set of environment variables to run correctly, and once again, these should not be set when running the other 'flavors' of tests.

 

And all of our tests are based on JUnit, so using JUnit default settings is not a solution for me.

 

I haven't found a solution to this problem; and if there is one that I'm unaware of I'd greatly appreciate a pointer to it.

 

If not, I've had two ideas about possible solutions:

1) Adding additional applications for each of my test types under 'Defaults' on the Run/Debug Configurations page.  Similar to the JUnit application but with VM and Environment preset to the values we need.  I haven't found a built-in way to do this, so I'm wondering if this could be done via plugin.

 

2) A plugin that lets me store common run configurations for JUnit, and from a dialog box allow me to quickly select and set the JUnit defaults so that any time I use the Create or Debug option in the source context menu, it will create the test using the current Junit defaults that I selected.

 

The second option seems to me to be more universally useful.  A dialog box with a 'save' button to save the current JUnit settings with a named configuration, and a list selection with an 'apply' button to restore the settings.

 

Which leads me to the plugin.  This is my first plugin, and I've been reading through the documentation, but I have not been able to figure out how I should hook into the IDE to make this work.  I have managed to add a menu option under 'Run' to bring up my dialog, but the actual mechanics of hooking into the objects is stopping me.  One 'work-around' that feels prone to maintenance problems and future failure is to read the configuration xml and parse/update the information there, but I don't believe this file is documented, so relying on it's structure seems like a hack rather than a solution.

 

Can anyone give me some pointers at what I should be looking at to accomplish this task?

 

Thanks!


Viewing all articles
Browse latest Browse all 5481

Trending Articles