How to set JVM parameters for Junit Unit Tests?

前端 未结 8 739
青春惊慌失措
青春惊慌失措 2020-11-28 03:47

I have some Junit unit tests that require a large amount of heap-space to run - i.e. 1G. (They test memory-intensive functionality for a webstart app that will only run with

8条回答
  •  青春惊慌失措
    2020-11-28 04:18

    I agree with the others who said that there is no simple way to distribute these settings.

    For Eclipse: ask your colleagues to set the following:

    • Windows Preferences / Java / Installed JREs:
    • Select the proper JRE/JDK (or do it for all of them)
    • Edit
    • Default VM arguments: -Xmx1024m
    • Finish, OK.

    After that all test will run with -Xmx1024m but unfortunately you have set it in every Eclipse installation. Maybe you could create a custom Eclipse package which contains this setting and give it to you co-workers.

    The following working process also could help: If the IDE cannot run a test the developer should check that Maven could run this test or not.

    • If Maven could run it the cause of the failure usually is the settings of the developer's IDE. The developer should check these settings.
    • If Maven also could not run the test the developer knows that the cause of the failure is not the IDE, so he/she could use the IDE to debug the test.

提交回复
热议问题