How can I set defaults for test configurations?

已回答

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

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

请先登录再写评论。