The goog.testing.DeferredTestCase Class

goog.testing.DeferredTestCase
> goog.testing.AsyncTestCase
> goog.testing.TestCase

goog.testing.DeferredTestCase(opt_name)

A test case that can asynchronously wait on a Deferred object.

opt_name {string=}
A descriptive name for the test case.

.add(test)

Inherited from goog.testing.TestCase .

Adds a new test to the test case.

test {goog.testing.TestCase.Test}
The test to add.

.addWaitForAsync(msg, d)

Adds a callback to update the wait message of this async test case. Using this method generously also helps to document the test flow.

msg {string}
The update wait status message.
d {goog.async.Deferred}
The deferred object to add the waitForAsync callback to.
@see
goog.testing.AsyncTestCase#waitForAsync

.autoDiscoverTests()

Inherited from goog.testing.TestCase .

Adds any functions defined in the global scope that are prefixed with "test" to the test case. Also overrides setUp, tearDown, setUpPage, tearDownPage and runTests if they are defined.

.continueTesting()

Inherited from goog.testing.AsyncTestCase .

Continue with the next step in the test cycle.

.createAndInstall(opt_name)

Preferred way of creating a DeferredTestCase. Creates one and initializes it with the G_testRunner.

opt_name {string=}
A descriptive name for the test case.
returns {goog.testing.DeferredTestCase}
The created DeferredTestCase.

.cycleTests()

Inherited from goog.testing.AsyncTestCase .

Starts the tests.

.doAsyncError(opt_e)

Inherited from goog.testing.AsyncTestCase .

Handles an exception thrown by a test.

opt_e {*=}
The exception object associated with the failure or a string.
@throws
Always throws a ControlBreakingException.

.enableDebugLogging()

Inherited from goog.testing.AsyncTestCase .

Enables verbose logging of what is happening inside of the AsyncTestCase.

.execute()

Inherited from goog.testing.TestCase .

Executes each of the tests.

.finalize()

Inherited from goog.testing.AsyncTestCase .

Finalizes the test case, called when the tests have finished executing.

.getActuallyRunCount()

Inherited from goog.testing.TestCase .

Returns the number of tests actually run in the test case, i.e. subtracting any which are skipped.

returns {number}
The number of un-ignored tests.

.getCount()

Inherited from goog.testing.TestCase .

Returns the number of tests contained in the test case.

returns {number}
The number of tests.

.getGlobals(opt_prefix)

Inherited from goog.testing.TestCase .

Gets the object with all globals.

opt_prefix {string=}
An optional prefix. If specified, only get things under this prefix.
returns {Object}
An object with all globals starting with the prefix.

.getNumFilesLoaded()

Inherited from goog.testing.TestCase .

Returns the number of script files that were loaded in order to run the test.

returns {number}
The number of script files.

.getReport(opt_verbose)

Inherited from goog.testing.TestCase .

Returns a string detailing the results from the test.

opt_verbose {boolean=}
If true results will include data about all tests, not just what failed.
returns {string}
The results from the test.

.getRunTime()

Inherited from goog.testing.TestCase .

Returns the amount of time it took for the test to run.

returns {number}
The run time, in milliseconds.

.isInsideMultiTestRunner()

Inherited from goog.testing.TestCase .

returns {boolean}
Whether the test case is running inside the multi test runner.

.isSuccess()

Inherited from goog.testing.TestCase .

returns {boolean}
Whether the test was a success.

.log(val)

Inherited from goog.testing.TestCase .

Logs an object to the console, if available.

val {*}
The value to log. Will be ToString'd.

.logError(name, opt_e)

Inherited from goog.testing.TestCase .

name {string}
Failed test name.
opt_e {*=}
The exception object associated with the failure or a string.
returns {goog.testing.TestCase.Error}
Error object.

.next()

Inherited from goog.testing.TestCase .

Returns the current test and increments the pointer.

returns {goog.testing.TestCase.Test?}
The current test case.

.order {string}

Inherited from goog.testing.TestCase .

The order to run the auto-discovered tests in.

.reset()

Inherited from goog.testing.TestCase .

Resets the test case pointer, so that next returns the first test.

.runTests()

Inherited from goog.testing.AsyncTestCase .

Sets up the test page and then waits until the test case has been marked as ready before executing the tests.

.running {boolean}

Inherited from goog.testing.TestCase .

Whether the test case is running.

.saveMessage(message)

Inherited from goog.testing.TestCase .

Saves a message to the result set.

message {string}
The message to save.

.setCompletedCallback(fn)

Inherited from goog.testing.TestCase .

Sets the callback function that should be executed when the tests have completed.

fn {Function}
The callback function.

.setTestRunner(tr)

Inherited from goog.testing.TestCase .

Sets the test runner that is running this test case.

tr {goog.testing.TestRunner}
The test runner.

.setUp()

Inherited from goog.testing.TestCase .

Gets called before every goog.testing.TestCase.Test is been executed. Can be overridden to add set up functionality to each test.

.setUpPage()

Inherited from goog.testing.TestCase .

Gets called before any tests are executed. Can be overridden to set up the environment for the whole test case.

.shouldRunTests()

Inherited from goog.testing.TestCase .

Can be overridden in test classes to indicate whether the tests in a case should be run in that particular situation. For example, this could be used to stop tests running in a particular browser, where browser support for the class under test was absent.

returns {boolean}
Whether any of the tests in the case should be run.

.started {boolean}

Inherited from goog.testing.TestCase .

Whether the test case has ever tried to execute.

.stepTimeout {number}

Inherited from goog.testing.AsyncTestCase .

How long to wait for a single step of a test to complete in milliseconds. A step starts when a call to waitForAsync() is made.

.tearDown()

Inherited from goog.testing.TestCase .

Gets called after every goog.testing.TestCase.Test has been executed. Can be overriden to add tear down functionality to each test.

.tearDownPage()

Inherited from goog.testing.TestCase .

Gets called after all tests have been executed. Can be overridden to tear down the entire test case.

.timeToSleepAfterFailure {number}

Inherited from goog.testing.AsyncTestCase .

How long to wait after a failed test before moving onto the next one. The purpose of this is to allow any pending async callbacks from the failing test to finish up and not cause the next test to fail.

.waitForAsync(opt_name)

Inherited from goog.testing.AsyncTestCase .

Informs the testcase not to continue to the next step in the test cycle until continueTesting is called.

opt_name {string=}
A description of what we are waiting for.

.waitForDeferred(a, opt_b)

Wires up given Deferred object to the test case, then starts the goog.async.Deferred object's callback.

a {!string|goog.async.Deferred}
The wait status message or the deferred object to wait for.
opt_b {goog.async.Deferred=}
The deferred object to wait for.