UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

56 lines (54 loc) 62.6 kB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.testing.AsyncTestCase</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class goog.testing.AsyncTestCase</h1><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l125">code &raquo;</a><pre><code><a href="class_goog_testing_TestCase.html">goog.testing.TestCase</a> &#x2514; goog.testing.AsyncTestCase</code></pre></header><section><p>A test case that is capable of running tests the contain asynchronous logic.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.testing.AsyncTestCase <span class="args">( opt_name )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>A descriptive name for the test case.</dl></table></div></div></div></section><section><h2>Classes</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="class_goog_testing_AsyncTestCase_ControlBreakingException.html">goog.testing.AsyncTestCase.ControlBreakingException</a><dd>An exception class used solely for control flow.</dl></table></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="typedefs"><h2>Type Definitions</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l136">code &raquo;</a><a class="member" name="goog.testing.AsyncTestCase.TopStackFuncResult_">goog.testing.AsyncTestCase.TopStackFuncResult_</a> : <code class="type">{controlBreakingExceptionThrown: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>, message: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}</code></div><div>Represents result of top stack function call.</div></summary></details></div></div></section><section id="instance-methods"><h2>Instance Methods</h2><h3>Defined in <code class="type">goog.testing.AsyncTestCase</code></h3><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l749">code &raquo;</a><span class="member"><a name="callTopOfStackFunc_">callTopOfStackFunc_</a> <span class="args">( func )</span> &rArr; <code class="type">!<a href="class_goog_testing_AsyncTestCase.html#goog.testing.AsyncTestCase.TopStackFuncResult_">goog.testing.AsyncTestCase.TopStackFuncResult_</a></code></span></div><p>Calls the given function, redirecting any exceptions to doAsyncError.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>func: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function to call.</dl><tr><th>Returns<tr><td><dl>Returns a TopStackFuncResult_.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l377">code &raquo;</a><span class="member"><a name="continueTesting">continueTesting</a> <span class="args">( )</span></span></div><p>Continue with the next step in the test cycle.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l512">code &raquo;</a><span class="member"><a name="cycleTests">cycleTests</a> <span class="args">( )</span></span></div><p>Starts the tests.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l544">code &raquo;</a><span class="member"><a name="dbgLog_">dbgLog_</a> <span class="args">( message )</span></span></div><p>Logs the given debug message to the console (when enabled).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>message: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The message to log.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l439">code &raquo;</a><span class="member"><a name="doAsyncError">doAsyncError</a> <span class="args">( opt_e )</span></span></div><p>Handles an exception thrown by a test.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_e: <code class="type">*=</code><dd>The exception object associated with the failure or a string.</dl><tr><th>Throws<tr><td><dl><dt><dd>throws a ControlBreakingException.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l582">code &raquo;</a><span class="member"><a name="doAsyncErrorTearDown_">doAsyncErrorTearDown_</a> <span class="args">( )</span></span></div><p>Calls the tearDown function, catching any errors, and then moves on to the next step in the testing cycle.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l872">code &raquo;</a><span class="member"><a name="doExecute_">doExecute_</a> <span class="args">( )</span></span></div><p>Step 3: Call test.execute().</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l836">code &raquo;</a><span class="member"><a name="doIteration_">doIteration_</a> <span class="args">( )</span></span></div><p>Step 1: Move to the next test.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l893">code &raquo;</a><span class="member"><a name="doNext_">doNext_</a> <span class="args">( )</span></span></div><p>Step 5: Call doSuccess()</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l826">code &raquo;</a><span class="member"><a name="doSetUpPage_">doSetUpPage_</a> <span class="args">( )</span></span></div><p>Sets up the test page and then waits untill the test case has been marked as ready before executing the tests.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l860">code &raquo;</a><span class="member"><a name="doSetUp_">doSetUp_</a> <span class="args">( )</span></span></div><p>Step 2: Call setUp().</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l882">code &raquo;</a><span class="member"><a name="doTearDown_">doTearDown_</a> <span class="args">( )</span></span></div><p>Step 4: Call tearDown().</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l558">code &raquo;</a><span class="member"><a name="doTopOfStackAsyncError_">doTopOfStackAsyncError_</a> <span class="args">( opt_e )</span></span></div><p>Wraps doAsyncError() for when we are sure that the test runner has no user code above it in the stack.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_e: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a>)=</code><dd>The exception object associated with the failure or a string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l534">code &raquo;</a><span class="member"><a name="enableDebugLogging">enableDebugLogging</a> <span class="args">( )</span></span></div><p>Enables verbose logging of what is happening inside of the AsyncTestCase.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l390">code &raquo;</a><span class="member"><a name="endCurrentStep_">endCurrentStep_</a> <span class="args">( )</span></span></div><p>Ends the current test step and queues the next test step to run.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l524">code &raquo;</a><span class="member"><a name="finalize">finalize</a> <span class="args">( )</span></span></div><p>Finalizes the test case, called when the tests have finished executing.</summary></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l341">code &raquo;</a><span class="member"><a name="getCurrentStepName">getCurrentStepName</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>The current step name.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Step name.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l622">code &raquo;</a><span class="member"><a name="hookAssert_">hookAssert_</a> <span class="args">( )</span></span></div><p>Replaces the asserts.js assert_() and fail() functions with a wrappers to catch the exceptions.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l654">code &raquo;</a><span class="member"><a name="hookOnError_">hookOnError_</a> <span class="args">( )</span></span></div><p>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.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l776">code &raquo;</a><span class="member"><a name="pump_">pump_</a> <span class="args">( opt_doFirst )</span></span></div><p>Calls the next callback when the isReady_ flag is true.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_doFirst: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>=</code><dd>A function to call before pumping.</dl><tr><th>Throws<tr><td><dl><dt><dd>a ControlBreakingException if there were any failing steps.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l498">code &raquo;</a><span class="member"><a name="runTests">runTests</a> <span class="args">( )</span></span></div><p>Sets up the test page and then waits until the test case has been marked as ready before executing the tests.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l736">code &raquo;</a><span class="member"><a name="setNextStep_">setNextStep_</a> <span class="args">( func, name )</span></span></div><p>Sets the next function to call in our sequence of async callbacks.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>func: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function that executes the next step.<dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A description of the next step.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l425">code &raquo;</a><span class="member"><a name="signal">signal</a> <span class="args">( )</span></span></div><p>Signals once to continue with the test. If this is the last signal that the test was waiting on, call continueTesting.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l703">code &raquo;</a><span class="member"><a name="startTimeoutTimer_">startTimeoutTimer_</a> <span class="args">( )</span></span></div><p>Enables the timeout timer. This timer fires unless continueTesting is called.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l721">code &raquo;</a><span class="member"><a name="stopTimeoutTimer_">stopTimeoutTimer_</a> <span class="args">( )</span></span></div><p>Disables the timeout timer.</summary></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l686">code &raquo;</a><span class="member"><a name="unhookAll_">unhookAll_</a> <span class="args">( )</span></span></div><p>Unhooks window.onerror and _assert.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l364">code &raquo;</a><span class="member"><a name="waitForAsync">waitForAsync</a> <span class="args">( opt_name )</span></span></div><p>Informs the testcase not to continue to the next step in the test cycle until continueTesting is called.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>A description of what we are waiting for.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l412">code &raquo;</a><span class="member"><a name="waitForSignals">waitForSignals</a> <span class="args">( times, opt_name )</span></span></div><p>Informs the testcase not to continue to the next step in the test cycle until signal is called the specified number of times. Within a test, this function behaves additively if called multiple times; the number of signals to wait for will be the sum of all expected number of signals this function was called with.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>times: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number of signals to receive before continuing testing.<dt>opt_name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>A description of what we are waiting for.</dl></table></div></details></div></div><h3>Defined in <code class="type"><a href="class_goog_testing_TestCase.html">goog.testing.TestCase</a></code></h3><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l289">code &raquo;</a><span class="member"><a name="add">add</a> <span class="args">( test )</span></span></div><p>Adds a new test to the test case.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>test: <code class="type"><a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a></code><dd>The test to add.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l310">code &raquo;</a><span class="member"><a name="addNewTest">addNewTest</a> <span class="args">( name, ref, opt_scope )</span></span></div><p>Creates and adds a new test. Convenience function to make syntax less awkward when not using automatic test discovery.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The test name.<dt>ref: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>Reference to the test function.<dt>opt_scope: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Optional scope that the test function should be called in.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l751">code &raquo;</a><span class="member"><a name="autoDiscoverLifecycle">autoDiscoverLifecycle</a> <span class="args">( )</span></span></div><p>Adds any functions defined in the global scope that correspond to lifecycle events for the test case. Overrides setUp, tearDown, setUpPage, tearDownPage and runTests if they are defined.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l777">code &raquo;</a><span class="member"><a name="autoDiscoverTests">autoDiscoverTests</a> <span class="args">( )</span></span></div><p>Adds any functions defined in the global scope that are prefixed with "test" to the test case.</summary></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l933">code &raquo;</a><span class="member"><a name="clearTimeout">clearTimeout</a> <span class="args">( id )</span></span></div><p>Clears a timeout created by <code >this.timeout()</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>id: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A timeout id.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l900">code &raquo;</a><span class="member"><a name="countNumFilesLoaded_">countNumFilesLoaded_</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Counts the number of files that were loaded for dependencies that are required to run the test.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The number of files loaded.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l740">code &raquo;</a><span class="member"><a name="createTestFromAutoDiscoveredFunction">createTestFromAutoDiscoveredFunction</a> <span class="args">( name, ref )</span> &rArr; <code class="type">!<a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a></code></span></div><p>Creates a <code >goog.testing.TestCase.Test</code> from an auto-discovered function.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The name of the function.<dt>ref: <code class="type">function(): void</code><dd>The auto-discovered function.</dl><tr><th>Returns<tr><td><dl>The newly created test.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l1018">code &raquo;</a><span class="member"><a name="doError">doError</a> <span class="args">( test, opt_e )</span></span></div><p>Handles a test that failed.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>test: <code class="type"><a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a></code><dd>The test that failed.<dt>opt_e: <code class="type">*=</code><dd>The exception object associated with the failure or a string.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l998">code &raquo;</a><span class="member"><a name="doSuccess">doSuccess</a> <span class="args">( test )</span></span></div><p>Handles a test that passed.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>test: <code class="type"><a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a></code><dd>The test that passed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l404">code &raquo;</a><span class="member"><a name="execute">execute</a> <span class="args">( )</span></span></div><p>Executes each of the tests.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l349">code &raquo;</a><span class="member"><a name="getActuallyRunCount">getActuallyRunCount</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the number of tests actually run in the test case, i.e. subtracting any which are skipped.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The number of un-ignored tests.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l709">code &raquo;</a><span class="member"><a name="getAutoDiscoveryPrefix">getAutoDiscoveryPrefix</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The function name prefix used to auto-discover tests.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l718">code &raquo;</a><span class="member"><a name="getBatchTime">getBatchTime</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Time since the last batch of tests was started.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l339">code &raquo;</a><span class="member"><a name="getCount">getCount</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the number of tests contained in the test case.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The number of tests.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l648">code &raquo;</a><span class="member"><a name="getGlobals">getGlobals</a> <span class="args">( opt_prefix )</span> &rArr; <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code></span></div><p>Gets list of objects that potentially contain test cases. For IE 8 and below, this is the global "this" (for properties set directly on the global this or window) and the RuntimeObject (for global variables and functions). For all other browsers, the array simply contains the global this.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_prefix: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>An optional prefix. If specified, only get things under this prefix. Note that the prefix is only honored in IE, since it supports the RuntimeObject: http://msdn.microsoft.com/en-us/library/ff521039%28VS.85%29.aspx TODO: Remove this option.</dl><tr><th>Returns<tr><td><dl>A list of objects that should be inspected.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l153">code &raquo;</a><span class="member"><a name="getName">getName</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The name of the test.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l569">code &raquo;</a><span class="member"><a name="getNumFilesLoaded">getNumFilesLoaded</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the number of script files that were loaded in order to run the test.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The number of script files.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l528">code &raquo;</a><span class="member"><a name="getReport">getReport</a> <span class="args">( opt_verbose )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a string detailing the results from the test.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_verbose: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>If true results will include data about all tests, not just what failed.</dl><tr><th>Returns<tr><td><dl>The results from the test.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l560">code &raquo;</a><span class="member"><a name="getRunTime">getRunTime</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the amount of time it took for the test to run.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The run time, in milliseconds.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l579">code &raquo;</a><span class="member"><a name="getTestResults">getTestResults</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>&gt;</code></span></div><p>Returns the test results object: a map from test names to a list of test failures (if any exist).</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Tests results object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l330">code &raquo;</a><span class="member"><a name="getTests">getTests</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a>&gt;</code></span></div><p>Gets the tests.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The test array.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l957">code &raquo;</a><span class="member"><a name="getTimeStamp_">getTimeStamp_</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns the current time.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>HH:MM:SS.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l484">code &raquo;</a><span class="member"><a name="isInsideMultiTestRunner">isInsideMultiTestRunner</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether the test case is running inside the multi test runner.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l517">code &raquo;</a><span class="member"><a name="isSuccess">isSuccess</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether the test was a success.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l494">code &raquo;</a><span class="member"><a name="log">log</a> <span class="args">( val )</span></span></div><p>Logs an object to the console, if available.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>The value to log. Will be ToString'd.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l1038">code &raquo;</a><span class="member"><a name="logError">logError</a> <span class="args">( name, opt_e )</span> &rArr; <code class="type">!<a href="class_goog_testing_TestCase_Error.html">goog.testing.TestCase.Error</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Failed test name.<dt>opt_e: <code class="type">*=</code><dd>The exception object associated with the failure or a string.</dl><tr><th>Returns<tr><td><dl>Error object.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l830">code &raquo;</a><span class="member"><a name="maybeFailTestEarly">maybeFailTestEarly</a> <span class="args">( testCase )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>testCase: <code class="type"><a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a></code><dd>The current test case.</dl><tr><th>Returns<tr><td><dl>Whether the test was marked as failed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l358">code &raquo;</a><span class="member"><a name="next">next</a> <span class="args">( )</span> &rArr; <code class="type"><a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a></code></span></div><p>Returns the current test and increments the pointer.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The current test case.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l945">code &raquo;</a><span class="member"><a name="now">now</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The current time in milliseconds, don't use goog.now as some tests override it.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l606">code &raquo;</a><span class="member"><a name="orderTests_">orderTests_</a> <span class="args">( tests )</span></span></div><p>Reorders the tests depending on the <code >order</code> field.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>tests: <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a>&gt;</code><dd>An array of tests to reorder.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l977">code &raquo;</a><span class="member"><a name="pad_">pad_</a> <span class="args">( number )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Pads a number to make it have a leading zero if it's less than 10.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>number: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number to pad.</dl><tr><th>Returns<tr><td><dl>The resulting string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l373">code &raquo;</a><span class="member"><a name="reset">reset</a> <span class="args">( )</span></span></div><p>Resets the test case pointer, so that next returns the first test.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l475">code &raquo;</a><span class="member"><a name="saveMessage">saveMessage</a> <span class="args">( message )</span></span></div><p>Saves a message to the result set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>message: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The message to save.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l727">code &raquo;</a><span class="member"><a name="setBatchTime">setBatchTime</a> <span class="args">( batchTime )</span></span></div></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>batchTime: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Time since the last batch of tests was started.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l384">code &raquo;</a><span class="member"><a name="setCompletedCallback">setCompletedCallback</a> <span class="args">( fn )</span></span></div><p>Sets the callback function that should be executed when the tests have completed.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The callback function.</dl></table></div></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l321">code &raquo;</a><span class="member"><a name="setTests">setTests</a> <span class="args">( tests )</span></span></div><p>Sets the tests.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>tests: <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a>&gt;</code><dd>A new test array.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l695">code &raquo;</a><span class="member"><a name="setUp">setUp</a> <span class="args">( )</span></span></div><p>Gets called before every goog.testing.TestCase.Test is been executed. Can be overridden to add set up functionality to each test.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l681">code &raquo;</a><span class="member"><a name="setUpPage">setUpPage</a> <span class="args">( )</span></span></div><p>Gets called before any tests are executed. Can be overridden to set up the environment for the whole test case.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l396">code &raquo;</a><span class="member"><a name="shouldRunTests">shouldRunTests</a> <span class="args">( )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether any of the tests in the case should be run.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l702">code &raquo;</a><span class="member"><a name="tearDown">tearDown</a> <span class="args">( )</span></span></div><p>Gets called after every goog.testing.TestCase.Test has been executed. Can be overriden to add tear down functionality to each test.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l688">code &raquo;</a><span class="member"><a name="tearDownPage">tearDownPage</a> <span class="args">( )</span></span></div><p>Gets called after all tests have been executed. Can be overridden to tear down the entire test case.</summary></details></div></div><div class="wrap-details protected"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l919">code &raquo;</a><span class="member"><a name="timeout">timeout</a> <span class="args">( fn, time )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Calls a function after a delay, using the protected timeout.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The function to call.<dt>time: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Delay in milliseconds.</dl><tr><th>Returns<tr><td><dl>The timeout id.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testcase.js.src.html#l988">code &raquo;</a><span class="member"><a name="trimPath_">trimPath_</a> <span class="args">( path )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Trims a path to be only that after google3.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>path: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The path to trim.</dl><tr><th>Returns<tr><td><dl>The resulting string.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><h3>Defined in <code class="type">goog.testing.AsyncTestCase</code></h3><div class="wrap-details protected"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l280">code &raquo;</a><span class="member"><a name="activeTest">activeTest</a> : <code class="type">(<a href="class_goog_testing_TestCase_Test.html">goog.testing.TestCase.Test</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>The currently active test.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l272">code &raquo;</a><span class="member"><a name="cleanedUp_">cleanedUp_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Marks if the cleanUp() function has been called for the currently running test.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l231">code &raquo;</a><span class="member"><a name="curStepFunc_">curStepFunc_</a> : <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>The stage of the test we are currently on.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l239">code &raquo;</a><span class="member"><a name="curStepName_">curStepName_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>The name of the stage of the test we are currently on.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l201">code &raquo;</a><span class="member"><a name="enableDebugLogs_">enableDebugLogs_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Turn on extra logging to help debug failing async. tests.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l305">code &raquo;</a><span class="member"><a name="expectedSignalCount_">expectedSignalCount_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Number of signals to wait for before continuing testing when waitForSignals is used.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l288">code &raquo;</a><span class="member"><a name="inException_">inException_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>A flag to prevent recursive exception handling.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l296">code &raquo;</a><span class="member"><a name="isReady_">isReady_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Flag used to determine if we can move to the next step in the testing loop.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l247">code &raquo;</a><span class="member"><a name="nextStepFunc">nextStepFunc</a> : <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code></span></div><p>The stage of the test we should run next.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/asynctestcase.js.src.html#l255">code &raquo;</a><span class="member"><a name="nextStepName_">nextStepName_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>The name of the stage of the test we should run next.</summary></details></div></div><div class="wrap-details private"><div><details><sum