Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Netbeans use specific JVM parameters when running tests?

I'm using Netbeans with Maven and TestNG. When running tests with the maven surefire plugin, I can setup some configuration parameters, in particular the logging level used for my tests (trace):

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

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

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

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

like image 782
assylias Avatar asked Nov 10 '12 08:11

assylias


People also ask

How do I change the default JVM argument?

Yes, right click the project. Click Run as then Run Configurations . You can change the parameters passed to the JVM in the Arguments tab in the VM Arguments box. That configuration can then be used as the default when running the project.

Where do I put JVM parameters?

To add JVM parameters, choose New . The property is added to Custom parameters . The actual parameters used by a running JVM can be found in the development trace file of the corresponding server process. This results in parameter: "-agentlib:myagent=port=12345,dir=C:/Mydir" .


1 Answers

From the documentation of Netbeans 7.2 (see Netbeans 7.2 changes, section Maven) :

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

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

like image 191
Zólyomi István Avatar answered Sep 18 '22 03:09

Zólyomi István