How to set JVM parameters for Junit Unit Tests?

前端 未结 8 737
青春惊慌失措
青春惊慌失措 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:09

    An eclipse specific alternative limited to the java.library.path JVM parameter allows to set it for a specific source folder rather than for the whole jdk as proposed in another response:

    1. select the source folder in which the program to start resides (usually source/test/java)
    2. type alt enter to open Properties page for that folder
    3. select native in the left panel
    4. Edit the native path. The path can be absolute or relative to the workspace, the second being more change resilient.

    For those interested on detail on why maven argline tag should be preferred to the systemProperties one, look, for example:

    Pick up native JNI files in Maven test (lwjgl)

提交回复
热议问题