Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Answering my own question:</p> <p>Netbeans runs the commands via ant, so in ${project_name}private/build-impl.xml are all the logic about project IDE commands.</p> <p>For execute the unit test, the IDE uses the junit ant's task:</p> <pre><code>&lt;macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"&gt; &lt;attribute default="${includes}" name="includes"/&gt; &lt;attribute default="${excludes}" name="excludes"/&gt; &lt;attribute default="**" name="testincludes"/&gt; &lt;attribute default="" name="testmethods"/&gt; &lt;element name="customize" optional="true"/&gt; &lt;sequential&gt; &lt;property name="junit.forkmode" value="perTest"/&gt; &lt;junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"&gt; &lt;test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/&gt; &lt;syspropertyset&gt; &lt;propertyref prefix="test-sys-prop."/&gt; &lt;mapper from="test-sys-prop.*" to="*" type="glob"/&gt; &lt;/syspropertyset&gt; &lt;formatter type="brief" usefile="false"/&gt; &lt;formatter type="xml"/&gt; &lt;jvmarg value="-ea"/&gt; &lt;customize/&gt; &lt;/junit&gt; &lt;/sequential&gt; &lt;/macrodef&gt; </code></pre> <p>The interesting line is:</p> <pre><code>&lt;property name="junit.forkmode" value="perTest"/&gt; </code></pre> <p>From Junit Task documentation junit.forkmode:</p> <blockquote> <p>Controls how many Java Virtual Machines get created if you want to fork some tests. Possible values are "perTest" (the default), "perBatch" and "once". "once" creates only a single Java VM for all tests while "perTest" creates a new VM for each TestCase class. "perBatch" creates a VM for each nested and one collecting all nested s. Note that only tests with the same settings of filtertrace, haltonerror, haltonfailure, errorproperty and failureproperty can share a VM, so even if you set forkmode to "once", Ant may have to create more than a single Java VM. This attribute is ignored for tests that don't get forked into a new Java VM. since Ant 1.6.2</p> </blockquote> <p>Conclusion: Netbeans runs the junit test in forkMode=perTest, so it creates a new VM for each TestCase class, otherwise NewTestSuite only uses one VM. </p> <p>For more detail about forkMode=perTest: <a href="https://stackoverflow.com/questions/6254965/junit-impact-of-forkmode-once-on-test-correctness/6264198#6264198">junit: impact of forkMode=&quot;once&quot; on test correctness</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload