Bug 342342

Summary: Add option "VM arguments" for JUnit in Preferences
Product: [Eclipse Project] JDT Reporter: Roman Ivanov <ivanov-jr>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: balz.guenat, lyle_z, stephan.herrmann
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Roman Ivanov CLA 2011-04-08 21:20:40 EDT
Build Identifier: Build id: 20110218-0911

It will be very convenient to provide default values for "VM arguments" for each UT that is launched for certain workspace.

We have convenient group in preferences "Java - JUnit" - It has option for "-ea".
It will be very convenient to have default "VM arguments" for JUnit launcher. Such filed we already have in Debug Configurations dialog.

Example: each user have its own link to db and UTs, as option, expect db link to be provided by sys variable to avoid code changes.

Reproducible: Always
Comment 1 Lyle Ziegelmiller CLA 2018-08-06 12:24:33 EDT
I agree.  Preferences -> Java -> JUnit: "Add '-ea' to VM arguments when creating a new JUnit launch configuration" should have the box checked by default.
Comment 2 Balz Guenat CLA 2018-10-11 05:22:39 EDT
I know this is a very old request but it might gain more relevance now, since from Java 9 on, users might need to use --add-modules regularly (see [1] for example).

It might also be possible to reach a similar functionality with the new Launch Prototypes, but I have not checked that.

[1]: https://stackoverflow.com/a/47412779/1280947
Comment 3 Stephan Herrmann CLA 2018-10-11 08:18:58 EDT
I see different issues here:

(In reply to Lyle Z from comment #1)
> I agree.  Preferences -> Java -> JUnit: "Add '-ea' to VM arguments when
> creating a new JUnit launch configuration" should have the box checked by
> default.

This should be obsolete since bug 479553, no?

(In reply to Balz Guenat from comment #2)
> I know this is a very old request but it might gain more relevance now,
> since from Java 9 on, users might need to use --add-modules regularly (see
> [1] for example).
> 
> It might also be possible to reach a similar functionality with the new
> Launch Prototypes, but I have not checked that.
> 
> [1]: https://stackoverflow.com/a/47412779/1280947

To me it feels wrong if you want to add "--add-modules X" to all JUnit launches *of your workspace*. We are, however, considering new UI which would allow you to configure such dependency as a property of your test folder. See our WIP in https://wiki.eclipse.org/Java9/ModularityOptions