ZaDarkSide / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Eclipse plugin and exceptions #312

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have three similar exception related problems. They all exists only when I'm, 
using jstd from the eclipse. Command line works fine.

1.) If all tests pass on green without error and fail, js-test-driver throws 
FailureException. The exception is uncatched and GUI shows an internal error:
    An internal error occurred during: "Run js-test-driver Tests Job".
    No tests executed.

Error log:
!ENTRY org.eclipse.core.jobs 4 2 2011-12-21 12:27:53.979
!MESSAGE An internal error occurred during: "Run js-test-driver Tests Job".
!STACK 0
com.google.jstestdriver.FailureException: No tests executed.
    at com.google.jstestdriver.FailureCheckerAction.run(FailureCheckerAction.java:50)
    at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:81)
    at com.google.jstestdriver.JsTestDriver.runConfigurationWithFlags(JsTestDriver.java:384)
    at com.google.jstestdriver.JsTestDriver.runTests(JsTestDriver.java:304)
    at com.google.jstestdriver.JsTestDriver.runTests(JsTestDriver.java:297)
    at com.google.eclipse.javascript.jstestdriver.core.JstdTestRunner.runTests(JstdTestRunner.java:43)
    at com.google.eclipse.javascript.jstestdriver.ui.launch.EclipseTestRunnerJob.run(EclipseTestRunnerJob.java:88)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

2.) If some test failed, js-test-driver throws FailureException. The exception 
is uncatched and GUI shows an internal error:
    An internal error occurred during: "Run js-test-driver Tests Job".
    Tests failed. See log for details.

Error log:
!ENTRY org.eclipse.core.jobs 4 2 2011-12-21 10:13:45.750
!MESSAGE An internal error occurred during: "Run js-test-driver Tests Job".
!STACK 0
com.google.jstestdriver.FailureException: Tests failed. See log for details.
    at com.google.jstestdriver.FailureCheckerAction.run(FailureCheckerAction.java:44)
    at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:81)
    at com.google.jstestdriver.JsTestDriver.runConfigurationWithFlags(JsTestDriver.java:384)
    at com.google.jstestdriver.JsTestDriver.runAllTests(JsTestDriver.java:291)
    at com.google.jstestdriver.JsTestDriver.runAllTests(JsTestDriver.java:284)
    at com.google.eclipse.javascript.jstestdriver.core.JstdTestRunner.runAllTests(JstdTestRunner.java:39)
    at com.google.eclipse.javascript.jstestdriver.ui.launch.EclipseTestRunnerJob.run(EclipseTestRunnerJob.java:86)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

3.) All exception raised by jstd are uncatched in the eclipse plugin. They 
result in an internal error and are treated by the eclipse as plugin bugs. E.g. 
they are logged and shown to the user in the same GUI as null pointer 
exceptions. 

The legitimate BrowserPluginException looks like the plugin bug.

Original issue reported on code.google.com by m.jurcov...@gmail.com on 21 Dec 2011 at 11:30

GoogleCodeExporter commented 8 years ago
The first problem: js-test-driver is build differently when run from command 
line and when run from the eclipse:
* command line: JsTestdriver configuration runs through 
TestResultPrintingModule.configure() method. This method adds 
TestResultHolder.class to Multibinder. Multibinder uses onTestComplete method 
to broadcast all tests results to TestResultHolder. As a result, 
FailureCheckerAction is informed about all passed tests.

* eclipse: JsTestdriver is build in getJstd() method of JstdTestRunner. The 
method never adds TestResultHolder to the list of test result listeners. 
Therefore, FailureCheckerAction always assumes that no tests have been run. 

I do not feel confident in js-test-driver binding enought to fix this.

Original comment by m.jurcov...@gmail.com on 21 Dec 2011 at 11:32

GoogleCodeExporter commented 8 years ago
The second problem is caused by the --raiseOnFailure flag added in 
JsTestDriver.createFlagsArray(String...coreflags) method. The method is called 
only when the tests are run from the eclipse plugin. Attached patch removes the 
flag.

This patch fixes also the problem 1, but I do not know whether it is 'by 
design' or whether it accidently hides another bug.

Original comment by m.jurcov...@gmail.com on 21 Dec 2011 at 11:33

Attachments:

GoogleCodeExporter commented 8 years ago
Simulate the third problem: 
1.) Create a long running test case (see attachment).
2.) Run it.
3.) Close the browser while the test is running.
4.) Wait long enought.

Eclipse shows an error:
An internal error occurred during: "Run js-test-driver Tests Job".
Failures during test run.

Error log:
!ENTRY org.eclipse.core.jobs 4 2 2011-12-21 12:42:44.677
!MESSAGE An internal error occurred during: "Run js-test-driver Tests Job".
!STACK 0
Failures during test run.
Caused by:
com.google.jstestdriver.browser.BrowserPanicException: Browser Chrome 
16.0.912.63 Windows
During 
{"browserInfo":{"id":1324467689658,"name":"Chrome","version":"16.0.912.63","os":
"Windows","uploadSize":50,"serverReceivedHeartbeat":true,"ready":true},"cause":"
Browser unresponsive since 2011-12-21T11:42:13.972Z during command\u003d 
{\"command\":\"runTests\",\"parameters\":[\"[\\\"SlowTest.testSlowGreet1\\\",\\\
"SlowTest.testSlowGreet2\\\"]\",\"false\",\"1\"]}"}
    at com.google.jstestdriver.CommandTask.run(CommandTask.java:136)
    at com.google.jstestdriver.JsTestDriverClientImpl.sendCommand(JsTestDriverClientImpl.java:103)
    at com.google.jstestdriver.JsTestDriverClientImpl.runTests(JsTestDriverClientImpl.java:141)
    at com.google.jstestdriver.RunTestsAction.run(RunTestsAction.java:70)
    at com.google.jstestdriver.browser.BrowserActionRunner.call(BrowserActionRunner.java:70)
    at com.google.jstestdriver.browser.BrowserActionRunner.call(BrowserActionRunner.java:37)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(BrowserActionExecutorAction.java:149)
    at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:81)
    at com.google.jstestdriver.JsTestDriver.runConfigurationWithFlags(JsTestDriver.java:384)
    at com.google.jstestdriver.JsTestDriver.runTests(JsTestDriver.java:304)
    at com.google.jstestdriver.JsTestDriver.runTests(JsTestDriver.java:297)
    at com.google.eclipse.javascript.jstestdriver.core.JstdTestRunner.runTests(JstdTestRunner.java:43)
    at com.google.eclipse.javascript.jstestdriver.ui.launch.EclipseTestRunnerJob.run(EclipseTestRunnerJob.java:88)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Caused by:com.google.jstestdriver.browser.BrowserPanicException: Browser Chrome 
16.0.912.63 Windows
During 
{"browserInfo":{"id":1324467689658,"name":"Chrome","version":"16.0.912.63","os":
"Windows","uploadSize":50,"serverReceivedHeartbeat":true,"ready":true},"cause":"
Browser unresponsive since 2011-12-21T11:42:13.972Z during command\u003d 
{\"command\":\"runTests\",\"parameters\":[\"[\\\"SlowTest.testSlowGreet1\\\",\\\
"SlowTest.testSlowGreet2\\\"]\",\"false\",\"1\"]}"}
com.google.jstestdriver.browser.BrowserPanicException: Browser Chrome 
16.0.912.63 Windows
During 
{"browserInfo":{"id":1324467689658,"name":"Chrome","version":"16.0.912.63","os":
"Windows","uploadSize":50,"serverReceivedHeartbeat":true,"ready":true},"cause":"
Browser unresponsive since 2011-12-21T11:42:13.972Z during command\u003d 
{\"command\":\"runTests\",\"parameters\":[\"[\\\"SlowTest.testSlowGreet1\\\",\\\
"SlowTest.testSlowGreet2\\\"]\",\"false\",\"1\"]}"}
    at com.google.jstestdriver.CommandTask.run(CommandTask.java:136)
    at com.google.jstestdriver.JsTestDriverClientImpl.sendCommand(JsTestDriverClientImpl.java:103)
    at com.google.jstestdriver.JsTestDriverClientImpl.runTests(JsTestDriverClientImpl.java:141)
    at com.google.jstestdriver.RunTestsAction.run(RunTestsAction.java:70)
    at com.google.jstestdriver.browser.BrowserActionRunner.call(BrowserActionRunner.java:70)
    at com.google.jstestdriver.browser.BrowserActionRunner.call(BrowserActionRunner.java:37)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Original comment by m.jurcov...@gmail.com on 21 Dec 2011 at 11:47

GoogleCodeExporter commented 8 years ago
The third problem: the attached patch catches two exceptions I managed to 
cause: 
* BrowserPanicException (during dry run),
* TestErrors.

It analyses what is found inside TestErrors and composes error message for the 
user. Almost all errors are shown as they came from the server. The only 
exception is browser panic exception - the patch adds (sort of) user friendly 
explanation to it.

Original comment by m.jurcov...@gmail.com on 21 Dec 2011 at 5:12

Attachments: