Home

# Class goog.testing.AsyncTestCase

A test case that is capable of running tests the contain asynchronous logic.

extends goog.testing.TestCase

Instance Method Summary
| `callTopOfStackFunc_(?Function func) ⇒ !goog.testing.AsyncTestCase.TopStackFuncResult_` Calls the given function, redirecting any exceptions to doAsyncError.
| `continueTesting()` Continue with the next step in the test cycle.
| `cycleTests()` Starts the tests.
| `dbgLog_(string message)` Logs the given debug message to the console (when enabled).
| `doAsyncError(<Any Type> opt_e)` Handles an exception thrown by a test.
| `doAsyncErrorTearDown_()` Calls the tearDown function, catching any errors, and then moves on to the next step in the testing cycle.
| `doExecute_()` Step 3: Call test.execute().
| `doIteration_()` Step 1: Move to the next test.
| `doNext_()` Step 5: Call doSuccess()
| `doSetUpPage_()` Sets up the test page and then waits untill the test case has been marked as ready before executing the tests.
| `doSetUp_()` Step 2: Call setUp().
| `doTearDown_()` Step 4: Call tearDown().
| `doTopOfStackAsyncError_((Error|null|string=) opt_e)` Wraps doAsyncError() for when we are sure that the test runner has no user code above it in the stack.
| `enableDebugLogging()` Enables verbose logging of what is happening inside of the AsyncTestCase.
| `finalize()` Finalizes the test case, called when the tests have finished executing.
| `hookAssert_()` Replaces the asserts.js assert_() and fail() functions with a wrappers to catch the exceptions.
| `hookOnError_()` Sets a window.onerror handler for catching exceptions that happen in async callbacks. Note that as of Safari 3.1, Safari does not support this.
| `pump_(?Function= opt_doFirst)` Calls the next callback when the isReady_ flag is true.
| `runTests()` Sets up the test page and then waits until the test case has been marked as ready before executing the tests.
| `setNextStep_(?Function func, string name)` Sets the next function to call in our sequence of async callbacks.
| `startTimeoutTimer_()` Enables the timeout timer. This timer fires unless continueTesting is called.
| `stopTimeoutTimer_()` Disables the timeout timer.
| `unhookAll_()` Unhooks window.onerror and _assert.
| `waitForAsync(string= opt_name)` Informs the testcase not to continue to the next step in the test cycle until continueTesting is called.

Static Method Summary
| `createAndInstall(string= opt_name) ⇒ ?goog.testing.AsyncTestCase` Preferred way of creating an AsyncTestCase. Creates one and initializes it with the G_testRunner.