Jarek
Jarek

Reputation: 7729

Eclipse - passing VM parameter to every test in the project

I need to pass a VM parameter to every test that is run in the project. Setting this manually doesn't seem to be the most convenient solution, so is there any possibility to pass the parameter to every test automatically.

Thank you for help.

Upvotes: 10

Views: 15049

Answers (4)

Daniel
Daniel

Reputation: 3057

We change the JRE Configuration in Eclipse (Preferences>Java>Installed JREs). There you can set default VM Arguments which are used for anything you run with that JRE.

Now simply configure your project to use this JRE (Java Build Path) and you should be on the right way.

Edit JRE - Eclipse

Upvotes: 23

zawhtut
zawhtut

Reputation: 8561

I think you are using "Program Argument" instead of "VM argument" now. If you use VM argument it's mean globally applied to all of your tests.

Upvotes: -1

djna
djna

Reputation: 55957

Run your test once, this creates a run configuration.

Run-> Run Configurations -> JUnit, select your run configuration, then you have an arguments tab to specify JVM or program arguments.

You can then duplicate this run configuration to use for other tests. I'm not aware of any way to make a default setting to be applied to all future test launches.

Upvotes: -1

Kit Ho
Kit Ho

Reputation: 27028

Eclipse have already a built-in JUnit for you.

You can use JUnit to run different parameters on your main program.

Upvotes: -1

Related Questions