Home

# Class goog.testing.ExpectedFailures

Helper class for allowing some unit tests to fail, particularly designed to mark tests that should be fixed on a given browser.

    var expectedFailures = new goog.testing.ExpectedFailures();

    function tearDown() {
    expectedFailures.handleTearDown();
    }

    function testSomethingThatBreaksInWebKit() {
    expectedFailures.expectFailureFor(goog.userAgent.WEBKIT);

    try {
    ...
    assert(somethingThatFailsInWebKit);
    ...
    } catch (e) {
    expectedFailures.handleException(e);
    }
    }

Instance Method Summary
| `expectFailureFor(boolean condition, string= opt_message)` Register to expect failure for the given condition. Multiple calls to this function act as a boolean OR. The first applicable message will be used.
| `getExpectationMessage_() ⇒ string`
| `handleException(?Error ex)` Handle an exception, suppressing it if it is a unit test failure that we expected.
| `handleTearDown()` Handle the tearDown phase of a test, alerting the user if an expected test was not suppressed.
| `isExceptionExpected(?Object ex) ⇒ boolean` Determines if the given exception was expected.
| `reset_()` Reset internal state.
| `run(?Function func, boolean= opt_lenient)` Run the given function, catching any expected failures.

Static Method Summary
| `setUpConsole_()` Sets up the debug console, if it isn't already set up.