ZaDarkSide / js-test-driver

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

test execution doesn't occur when json.js library is loaded #311

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use a config file (test.conf) with the following
  server: http://localhost:4224
  load:
    - json.js
  test:
    - sampleTest.js

2. Save the code from 
https://github.com/douglascrockford/JSON-js/blob/master/json.js into json.js or 
use the attached file 
3. Create a sample test file (sampleTest.js) with

  MyTestCase = TestCase("MyTestCase");

  MyTestCase.prototype.testA = function(){
  };

3. Execute
  java -jar JsTestDriver-1.3.3d.jar --config test.conf --port 4224  --tests all --browser "c:\Program Files\Internet explorer\iexplore.exe"

What is the expected output? What do you see instead?
Expect to see
Total 1 tests (Passed: 1; Fails: 0; Errors: 0) (0.00 ms)
  Microsoft Internet Explorer 9.0 Windows: Run 1 tests (Passed: 1; Fails: 0; Errors 0) (0.00 ms)

But seeing browser restart a couple of times and
Failures during test run.
Caused by:
Tried 3times:
com.google.jstestdriver.util.RetryException:
Failure 1: java.lang.RuntimeException: Could not start browser CommandLineBrowse
rRunner [
browserPath=c:\Program Files\Internet Explorer\iexplore.exe
args=,
process=java.lang.ProcessImpl@7c7780c2,
 process log={
error:

input:

}] in 30

-------- some more error output taken out --------------

Unexpected Runner Condition: Failures during test run.
 Use --runnerMode DEBUG for more information.

What version of the product are you using? On what operating system?
JsTestDriver-1.3.3d.jar.  Windows 7, IE9

Please provide any additional information below.
If I don't load json.js, the test runs fine. If I use FireFox 8, I immediately 
get
Failures during test run.
Caused by:
Tried 3times:
com.google.jstestdriver.util.RetryException:
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
        at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.j
ava:62)
        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)
Caused by: java.lang.NullPointerException
        at com.google.jstestdriver.browser.CommandLineBrowserRunner.stopBrowser(
CommandLineBrowserRunner.java:72)
        at com.google.jstestdriver.browser.BrowserControl.stopBrowser(BrowserCon
trol.java:133)
        at com.google.jstestdriver.browser.BrowserCallable.call(BrowserCallable.
java:30)
        at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.j
ava:49)
        ... 10 more

        at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(Brows
erActionExecutorAction.java:149)
        at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:81)

        at com.google.jstestdriver.JsTestDriver.runConfigurationWithFlags(JsTest
Driver.java:263)
        at com.google.jstestdriver.JsTestDriver.runConfiguration(JsTestDriver.ja
va:211)
        at com.google.jstestdriver.JsTestDriver.main(JsTestDriver.java:144)
Caused by:
Tried 3times:
com.google.jstestdriver.util.RetryException:
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
Unexpected Runner Condition: Failures during test run.
 Use --runnerMode DEBUG for more information.

Original issue reported on code.google.com by bwo...@gmail.com on 16 Dec 2011 at 6:39

Attachments:

GoogleCodeExporter commented 8 years ago
I don't have a way to edit the above post so, please ignore the Firefox error 
output (it was due to wrong exe path). The Firefox 8.0 behavior is the same as 
the IE 9 behavior when json.js is included.

Original comment by bwo...@gmail.com on 16 Dec 2011 at 6:47

GoogleCodeExporter commented 8 years ago
If I comment out lines 522-529 in json.js, i.e the 
Object.prototype.toJSONString function definition, then test runs fine.

Original comment by bwo...@gmail.com on 16 Dec 2011 at 6:59

GoogleCodeExporter commented 8 years ago

Original comment by corbinrs...@gmail.com on 27 Dec 2011 at 5:11

GoogleCodeExporter commented 8 years ago
Worked around the issue by checking out the JsTestDriver source and modifying 
all for..in loops to check hasOwnProperty in the jQuery library and other 
JavaScript files that get bundled into the jar.

Original comment by bwo...@gmail.com on 28 Dec 2011 at 4:51

GoogleCodeExporter commented 8 years ago
Here is svn diff of src directory if anyone is interested.  Diff doesn't 
include minified jquery file as I am using a different tool to do minification. 
Use at your own risk :).

Original comment by bwo...@gmail.com on 30 Dec 2011 at 2:24

Attachments: