How to set JVM parameters for Junit Unit Tests?

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

    According to this support question https://intellij-support.jetbrains.com/hc/en-us/community/posts/206165789-JUnit-default-heap-size-overridden-

    the -Xmx argument for an IntelliJ junit test run will come from the maven-surefire-plugin, if it's set.

    This pom.xml snippet

            
                org.apache.maven.plugins
                maven-surefire-plugin
                
                    -Xmx1024m
                
            
    

    seems to pass the -Xmx1024 argument to the junit test run, with IntelliJ 2016.2.4.

提交回复
热议问题