goog.testing.ContinuationTestCase
Classgoog.testing.ContinuationTestCase
> goog.testing.TestCase
goog.testing.ContinuationTestCase(opt_name)
Constructs a test case that supports tests with continuations. Test functions may issue "wait" commands that suspend the test temporarily and continue once the wait condition is met.
opt_name
{string
=}
.MAX_TIMEOUT
{number
}The default maximum time to wait for a single test step in milliseconds.
goog.testing.ContinuationTestCase.Step
ClassConstructs a single step in a larger continuation test. Each step is similar to a typical TestCase test, except it may wait for an event or timeout to occur before running the test function. … more
goog.testing.ContinuationTestCase.Test
ClassCreates a continuation test case, which consists of multiple test steps that occur in several phases. The steps are distributed between setUp, test, and tearDown phases. During the execution of each step, 0 or more steps may be added to the current phase. Once all steps in a phase have completed, the next phase will be executed. If any errors occur (such as an assertion failure), the setUp and Test phases will be cancelled immediately. The tearDown phase will always start, but may be cancelled as well if it raises an error. … more
.add(test)
Inherited from goog.testing.TestCase
.
Adds a new test to the test case.
test
{goog.testing.TestCase.Test
}
.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.
.clearTimeout(id)
[protected]Inherited from goog.testing.TestCase
.
Clears a timeout created by {@code this.timeout()}.
id
{number
}
.createTestFromAutoDiscoveredFunction(name, ref)
[protected]Inherited from goog.testing.TestCase
.
Creates a {@code goog.testing.TestCase.Test} from an auto-discovered function.
name
{string
}
ref
{function
() : void
}
goog.testing.TestCase.Test
}
.cycleTests()
Cycles through the tests, breaking out using a setTimeout if the execution time has execeeded {@link #MAX_RUN_TIME}.
.doError(test, opt_e)
[protected]Inherited from goog.testing.TestCase
.
Handles a test that failed.
test
{goog.testing.TestCase.Test
}
opt_e
{*=}
.doSuccess(test)
[protected]Inherited from goog.testing.TestCase
.
Handles a test that passed.
test
{goog.testing.TestCase.Test
}
.exceptionBeforeTest
[protected] {*}Inherited from goog.testing.TestCase
.
Exception object that was detected before a test runs.
.execute()
Inherited from goog.testing.TestCase
.
Executes each of the tests.
.finalize()
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.
number
}
.getAutoDiscoveryPrefix()
[protected]Inherited from goog.testing.TestCase
.
string
}
.getBatchTime()
[protected]Inherited from goog.testing.TestCase
.
number
}
.getCount()
Inherited from goog.testing.TestCase
.
Returns the number of tests contained in the test case.
number
}
.getGlobals(opt_prefix)
Inherited from goog.testing.TestCase
.
Gets the object with all globals.
opt_prefix
{string
=}
Object
}
.getNumFilesLoaded()
Inherited from goog.testing.TestCase
.
Returns the number of script files that were loaded in order to run the test.
number
}
.getReport(opt_verbose)
Inherited from goog.testing.TestCase
.
Returns a string detailing the results from the test.
opt_verbose
{boolean
=}
string
}
.getRunTime()
Inherited from goog.testing.TestCase
.
Returns the amount of time it took for the test to run.
number
}
.getTests()
[protected]Inherited from goog.testing.TestCase
.
Gets the tests.
Array
.<goog.testing.TestCase.Test
>}
.isInsideMultiTestRunner()
Inherited from goog.testing.TestCase
.
boolean
}
.isSuccess()
Inherited from goog.testing.TestCase
.
boolean
}
.log(val)
Inherited from goog.testing.TestCase
.
Logs an object to the console, if available.
val
{*}
.logError(name, opt_e)
Inherited from goog.testing.TestCase
.
name
{string
}
opt_e
{*=}
goog.testing.TestCase.Error
}
.maybeFailTestEarly(testCase)
[protected]Inherited from goog.testing.TestCase
.
Checks to see if the test should be marked as failed before it is run. If there was an error in setUpPage, we treat that as a failure for all tests and mark them all as having failed.
testCase
{goog.testing.TestCase.Test
}
boolean
}
.next()
Inherited from goog.testing.TestCase
.
Returns the current test and increments the pointer.
goog.testing.TestCase.Test
?}
.now()
[protected]Inherited from goog.testing.TestCase
.
number
}
.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()
Executes each of the tests. Overridable by the individual test case. This allows test cases to defer when the test is actually started. If overridden, finalize must be called by the test to indicate it has finished.
.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
}
.setBatchTime(batchTime)
[protected]Inherited from goog.testing.TestCase
.
batchTime
{number
}
.setCompletedCallback(fn)
Inherited from goog.testing.TestCase
.
Sets the callback function that should be executed when the tests have completed.
fn
{Function
}
.setTestRunner(tr)
Inherited from goog.testing.TestCase
.
Sets the test runner that is running this test case.
tr
{goog.testing.TestRunner
}
.setTests(tests)
[protected]Inherited from goog.testing.TestCase
.
Sets the tests.
tests
{Array
.<goog.testing.TestCase.Test
>}
.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.
boolean
}
.started
{boolean
}Inherited from goog.testing.TestCase
.
Whether the test case has ever tried to execute.
.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.
.timeout(fn, time)
[protected]Inherited from goog.testing.TestCase
.
Calls a function after a delay, using the protected timeout.
fn
{Function
}
time
{number
}
number
}
.waitForCondition(condition, continuation, opt_interval, opt_maxTimeout)
Creates a new test step which will run once a condition becomes true. The condition will be polled at a user-specified interval until it becomes true, or until a maximum timeout is reached.
condition
{Function
}
continuation
{Function
}
opt_interval
{number
=}
opt_maxTimeout
{number
=}
.waitForEvent(eventTarget, eventType, continuation)
Creates a new test step that will run after an event has fired. If the event does not fire within a reasonable timeout, the test will fail.
eventTarget
{goog.events.EventTarget
|EventTarget
}
eventType
{string
}
continuation
{Function
}
.waitForTimeout(continuation, opt_duration)
Creates a new test step that will run after a user-specified timeout. No guarantee is made on the execution order of the continuation, except for those provided by each browser's window.setTimeout. In particular, if two continuations are registered at the same time with very small delta for their durations, this class can not guarantee that the continuation with the smaller duration will be executed first.
continuation
{Function
}
opt_duration
{number
=}