Eclipse - passing VM parameter for each test in the project

I need to pass a VM parameter for every test that runs in a project. Manually setting this up does not seem to be the most convenient solution, so is it possible to automatically pass a parameter for each test.

Thank you for your help.

+6
source share
4 answers

We are changing the JRE configuration in Eclipse (Preferences> Java> Installed JREs). There you can set the default virtual machine arguments that are used for everything you use with this JRE.

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

Edit JRE - Eclipse

+17
source

Eclipse already has built-in JUnit for you.

You can use JUnit to run various parameters in your main program.

0
source

Run the test once, this will create a run configuration.

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

You can then duplicate this launch configuration for use with other tests. I do not know how to apply the default setting for all future test runs.

0
source

I think you are using the "Program argument" instead of the "VM argument". If you use the VM argument, this means a global application to all of your tests.

0
source

Source: https://habr.com/ru/post/892811/


All Articles