How to get Netbeans to use certain JVM parameters when running tests?

I am using Netbeans with Maven and TestNG. When I run tests with the maven surefire plugin, I can configure some configuration parameters, in particular the logging level used for my tests (tracing):

-Dorg.slf4j.simpleLogger.defaultLogLevel=trace -Dorg.slf4j.simpleLogger.logFile=System.out 

However, when you run a specific test file (CTRL + F6) or a test method ("run focused test method"), Netbeans does not use surefire (which is good) and therefore ignores these parameters.

Is there a way to change the JVM settings used by Netbeans when it runs tests this way?

This is somewhat similar to this other post , but my question is specific to Netbeans.

+6
source share
4 answers

From the Netbeans 7.2 documentation (see Netbeans 7.2 Changes, Maven Section ):

... Now Test File always launches Maven by default, just like Test Project ...

What version of Netbeans are you using? You should probably just upgrade to 7.2.

+6
source

In the project properties, you can create profiles in the Run section. In abstract profiles, you can configure virtual machine settings. Here you can add your parameters, create a test configuration and complete the configuration.

+5
source

Set the fork property in the surefire plugin configuration in Maven. This will launch the new JVM. Now the second part is reading the JVM parameters that you want to use in the new JVM. Depending on what you want to do, you may need to read them from the environment.

+1
source

In my case, I went to the project / properties, then to the "Actions" category. There you will find the actions "Test file" and "Debug test". Select them and put all the necessary properties in the "Set Properties" field.

Not sure if this applies only to Maven projects ...

0
source

All Articles