Automatically add properties when running JUnit in Eclipse

后端 未结 5 904
猫巷女王i
猫巷女王i 2021-02-04 05:08

In order to run my unit tests on my Eclipse, I need to set some properties for the VM.

Thus, when I first run my JUnit test, I go in \"Open Run Dialog\", then in my JUni

5条回答
  •  孤独总比滥情好
    2021-02-04 05:29

    You could try this - go to

     Window->Preferences->Java->Installed JREs
    

    ans select the JVM in use, than put a "Default VM" prameter like

      -DrunningInEclipse
    

    Than you can check from within your TestCase:

       System.getProperty("runningInEclipse") != null
    

提交回复
热议问题