开发者

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 para开发者_如何学Gometer to every test automatically.

Thank you for help.


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.

Eclipse - passing VM parameter to every test in the project


Eclipse have already a built-in JUnit for you.

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜