Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat happens in the background when testing a project in netbeans via Project->Menu->Test?
    text
    copied!<p>I have a java project created on netbeans, the project has some test in project's test packages.</p> <p>I have different behaviors when I test the project via Project->Menu->Test and test via creating junit4Suite with all class Test files.</p> <p>For example, one difference is the velocity:</p> <ul> <li>testing via suite: 58 test (all) takes 2.7 seconds</li> <li>testing via Project->Menu->Test: 58 test(all) takes 14.9 seconds</li> </ul> <p>What happens in background when netbeans is testing the project via Project->Menu->Test?</p> <p><strong>EDIT</strong>:</p> <p>The project is very small so the time netbeans takes before execute testing are around 1 second.</p> <p>Another diference:</p> <p>I have created another dummy project with a method that you can only run once:</p> <pre><code>public class ScriptThreadWorker { private static ScriptThreadWorker worker; private Thread thread; public static ScriptThreadWorker getWorker() { if (worker == null) { worker = new ScriptThreadWorker(); } return worker; } public void runOnScriptThread(Runnable task) { if (thread != null) { throw new RuntimeException("you can run once"); } thread = new Thread(task); thread.setName("ui-thread"); thread.start(); } } </code></pre> <p>And I have created 2 identical 2 test classes with a junit suite:</p> <p>ScriptThreadWorker1Test.java</p> <pre><code>public class ScriptThreadWorker1Test { @Test public void testRun1() { ScriptThreadWorker.getWorker().runOnScriptThread(new Runnable() { @Override public void run() { // do nothing } }); } } </code></pre> <p>ScriptThreadWorker2Test.java</p> <pre><code>public class ScriptThreadWorker2Test { @Test public void testRun1() { ScriptThreadWorker.getWorker().runOnScriptThread(new Runnable() { @Override public void run() { // do nothing } }); } } </code></pre> <p>NewTestSuite.java</p> <pre><code>@RunWith(Suite.class) @Suite.SuiteClasses({ javaapplication3.ScriptThreadWorker2Test.class, javaapplication3.ScriptThreadWorker1Test.class}) public class NewTestSuite { } </code></pre> <p>When I execute the test via Project->Menu->Test: "Both test passed"</p> <p>But when I execute the test via NewTestSuite.java->Menu->Test file: "1 test passed, 1 test caused an error, you can run once".</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