goog.testing.ExpectedFailures
Classgoog.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); } }
.expectFailureFor(condition, 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.
condition
{boolean
}
opt_message
{string
=}
.handleException(ex)
Handle an exception, suppressing it if it is a unit test failure that we expected.
ex
{Error
}
.handleTearDown()
Handle the tearDown phase of a test, alerting the user if an expected test was not suppressed.
.isExceptionExpected(ex)
Determines if the given exception was expected.
ex
{Object
}
boolean
}
.run(func, opt_lenient)
Run the given function, catching any expected failures.
func
{Function
}
opt_lenient
{boolean
=}