Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(48)

Issue 8907046: Reduce opportunities for undetected failures in JavaScript tests. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 10 months ago by kpreid2
Modified:
12 years, 10 months ago
Reviewers:
felix8a, ihab.awad
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

* Redesign asyncRequirements/assertAsynchronousRequirement: * Instead of mucking with the page title etc, asyncRequirements is defined in terms of registering additional 'tests' that jsunit.js knows about; this prevents incorrect passing-and-then-failing, and means that assertAsynchronousRequirement is as fire-and-forget as its name suggests. * Instead of just a nominally-a-predicate, there is a second function parameter for additional asserts to be executed once the predicate is true. * Fixed lack of verification of headless JS tests: * RhinoTestBed now actually tests that the jsunit tests it runs passed, rather than just that they did not throw an exception that escaped. (Future work: get rid of the _junit_.fail kludge, which has been left in for now for better error messages.) * Corrected implementation of document.title in third party env.js. * Added missing pass()es in tests that are now detected. * Added 'all tests passed' marker string to html-emitter-test.html which does not use jsunit.js. * Added new browser test driver meta-test.js, which loads known-failing test suites into iframes to verify they fail in the expected fashion. * Refinements and refactoring in jsunit.js and browser-test-case.js: * A test which passes and then fails, or fails or passes and then passes, is detected and considered failure. * Fixed undetected failures in es53-test-client-uri-rewriting.js (miswritten assert, not functionality error) and refactored. * Fixed duplicate pass in testProtoMention. * Added 'panic' facility, which guarantees the test page will fail, where throwing an exception that may be uncaught does not, and used it for all already caught cases of misuse of the test framework. * Test cases now individually remember their container elements, eliminating the need to pass around idClass info. The pass() wrapper around jsunitPass() is no longer necessary (but has been left for now). * Adjusted domado-dom-guest testReadOnly to be compatible (it had been replacing its testcontainer element with a clone). * jsunitRegisterIf is now defined inside jsunit.js. * jsunit.fail() added symmetric with jsunit.pass(), and both now update testcontainer elements. * Incidental changes: * Renamed misnamed test method in CssStylesheetTest.java. * Renamed misnamed title of css-stylesheet-test.html. @r5381

Patch Set 1 #

Total comments: 12

Patch Set 2 : Reduce opportunities for undetected failures in JavaScript tests. #

Total comments: 18

Patch Set 3 : Reduce opportunities for undetected failures in JavaScript tests. #

Patch Set 4 : Reduce opportunities for undetected failures in JavaScript tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+653 lines, -170 lines) Patch
M tests/com/google/caja/plugin/CssStylesheetTest.java View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/UniversalBrowserTests.java View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/browser-test-case.js View 1 2 3 8 chunks +42 lines, -35 lines 0 comments Download
M tests/com/google/caja/plugin/css-stylesheet-test.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/css-stylesheet-test.js View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M tests/com/google/caja/plugin/cssparser_test.js View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/default-test-driver.js View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-client-uri-rewriting.js View 1 2 3 4 chunks +32 lines, -29 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-dom-guest.html View 1 2 3 3 chunks +9 lines, -7 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-events.js View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-events-guest.html View 1 2 3 2 chunks +17 lines, -18 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-foreign.js View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-special.js View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/es53-test-external-script-guest.html View 1 2 3 1 chunk +7 lines, -13 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-language-guest.html View 1 2 3 2 chunks +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/es53-test-relative-urls.js View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/html-css-sanitizer-test.js View 1 2 3 4 chunks +8 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/html-emitter-test.html View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/jsunit.js View 1 2 3 11 chunks +167 lines, -55 lines 0 comments Download
A tests/com/google/caja/plugin/meta-test.js View 1 2 3 1 chunk +176 lines, -0 lines 0 comments Download
A tests/com/google/caja/plugin/meta-test-async-fails.js View 1 1 chunk +29 lines, -0 lines 0 comments Download
A tests/com/google/caja/plugin/meta-test-async-passes.js View 1 1 chunk +30 lines, -0 lines 0 comments Download
A tests/com/google/caja/plugin/meta-test-fails.html View 1 2 3 1 chunk +51 lines, -0 lines 0 comments Download
A tests/com/google/caja/plugin/meta-test-panic.html View 1 2 3 1 chunk +41 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/test-index.js View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M tests/com/google/caja/plugin/uri_test.js View 1 2 3 3 chunks +4 lines, -0 lines 0 comments Download
M tests/com/google/caja/util/RhinoTestBed.java View 1 2 3 1 chunk +10 lines, -2 lines 0 comments Download
M third_party/js/envjs/env.js View 1 2 3 1 chunk +5 lines, -1 line 0 comments Download
M third_party/js/jsunit/2.2/jsUnitCore.js View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 15
kpreid2
12 years, 10 months ago (2013-04-22 20:33:35 UTC) #1
felix8a
partial review; I haven't finished looking at the assertasync stuff yet https://codereview.appspot.com/8907046/diff/1/tests/com/google/caja/plugin/jsunit.js File tests/com/google/caja/plugin/jsunit.js (right): ...
12 years, 10 months ago (2013-04-23 00:00:56 UTC) #2
kpreid2
* Redesign asyncRequirements/assertAsynchronousRequirement: * Instead of mucking with the page title etc, asyncRequirements is defined ...
12 years, 10 months ago (2013-04-23 18:43:17 UTC) #3
kpreid2
New snapshot. https://codereview.appspot.com/8907046/diff/1/tests/com/google/caja/plugin/jsunit.js File tests/com/google/caja/plugin/jsunit.js (right): https://codereview.appspot.com/8907046/diff/1/tests/com/google/caja/plugin/jsunit.js#newcode356 tests/com/google/caja/plugin/jsunit.js:356: var node = testRecord.resultContainer; On 2013/04/23 00:00:56, ...
12 years, 10 months ago (2013-04-23 18:44:44 UTC) #4
felix8a
cool. lgtm
12 years, 10 months ago (2013-04-27 01:07:41 UTC) #5
ihab.awad
https://codereview.appspot.com/8907046/diff/7001/tests/com/google/caja/plugin/browser-test-case.js File tests/com/google/caja/plugin/browser-test-case.js (right): https://codereview.appspot.com/8907046/diff/7001/tests/com/google/caja/plugin/browser-test-case.js#newcode325 tests/com/google/caja/plugin/browser-test-case.js:325: jsunitRegisterAuxiliaryStatus(id); Confused about what this does, exactly. https://codereview.appspot.com/8907046/diff/7001/tests/com/google/caja/plugin/browser-test-case.js#newcode387 tests/com/google/caja/plugin/browser-test-case.js:387: ...
12 years, 10 months ago (2013-04-27 01:17:15 UTC) #6
kpreid2
* Redesign asyncRequirements/assertAsynchronousRequirement: * Instead of mucking with the page title etc, asyncRequirements is defined ...
12 years, 10 months ago (2013-04-27 01:54:05 UTC) #7
kpreid2
New snapshot. https://codereview.appspot.com/8907046/diff/7001/tests/com/google/caja/plugin/browser-test-case.js File tests/com/google/caja/plugin/browser-test-case.js (right): https://codereview.appspot.com/8907046/diff/7001/tests/com/google/caja/plugin/browser-test-case.js#newcode325 tests/com/google/caja/plugin/browser-test-case.js:325: jsunitRegisterAuxiliaryStatus(id); On 2013/04/27 01:17:16, ihab.awad wrote: > ...
12 years, 10 months ago (2013-04-27 01:54:38 UTC) #8
kpreid2
requested ping
12 years, 10 months ago (2013-04-29 17:17:34 UTC) #9
ihab.awad
lgtm
12 years, 10 months ago (2013-04-29 17:42:03 UTC) #10
kpreid2
New snapshot :( meta-test-fails is now HTML instead of bare JS. This is necessary for ...
12 years, 10 months ago (2013-04-29 19:06:31 UTC) #11
felix8a
I don't see the new snapshot? I only see patch set 3, created 2 days ...
12 years, 10 months ago (2013-04-29 19:30:09 UTC) #12
kpreid2
* Redesign asyncRequirements/assertAsynchronousRequirement: * Instead of mucking with the page title etc, asyncRequirements is defined ...
12 years, 10 months ago (2013-04-29 19:30:42 UTC) #13
kpreid2
On 2013/04/29 19:30:09, felix8a wrote: > I don't see the new snapshot? I only see ...
12 years, 10 months ago (2013-04-29 19:30:48 UTC) #14
felix8a
12 years, 10 months ago (2013-04-29 19:33:46 UTC) #15
lgtm
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b