How can I set defaults for test configurations?

Answered

I'd like to set the system property 'run.mode' to 'test' for any test I run in IntelliJ. I know I can create a custom configurations and specify the property in the settings, but I'd like this to be a default any time I click a right-click a test case and press "Run Blah".

Is that possible?

1
7 comments

The "Run/Debug" configuration dialog has tree of configurations on the left side.
One of the nodes (the bottom one for me) is called Defaults.

If you expand it, you can edit the defaults for any kind of run configuration type, including "JUnit test".
For example, by adding something to the "VM parameters" field for that run type.

-tt

5

Brilliant!

I'd never noticed that before. Thank you!

0

Where are the settings for the Default configurations saved?

I need to change the native library path for the default JUnit configuration.  I can change it in the UI, and the change is persisted somewhere, but I don't know where.

Thanks,
Jon

0

Try to search by configuration name in .idea and in idea system folder.

best regards, Alex

0

Turns out it's in workspace.xml in the root of the .idea directory (for directory-based projects).  The default run configurations are marked with "default='true'" attributes.

Thanks,
Jon

0

for newer versions it's called "Templates"

0

This feature has changed, it is now in "Edit configuration templates" which is below

0

Please sign in to leave a comment.