selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
17 lines (16 loc) • 16.1 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.testing.TestRunner</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.TestRunner</h1><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l49">code »</a></header><section><p>Construct a test runner.
NOTE(user): This is currently pretty weird, I'm essentially trying to
create a wrapper that the Selenium test can hook into to query the state of
the running test case, while making goog.testing.TestCase general.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.testing.TestRunner <span class="args">( )</span></span></div></div></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="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l251">code »</a><span class="member"><a name="execute">execute</a> <span class="args">( )</span></span></div><p>Executes a test case and prints the results to the window.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l243">code »</a><span class="member"><a name="getNumFilesLoaded">getNumFilesLoaded</a> <span class="args">( )</span> ⇒ <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/testrunner.js.src.html#l215">code »</a><span class="member"><a name="getReport">getReport</a> <span class="args">( opt_verbose )</span> ⇒ <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 report of the test case that ran.
Used by Selenium Hooks.</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>A report summary 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/testrunner.js.src.html#l234">code »</a><span class="member"><a name="getRunTime">getRunTime</a> <span class="args">( )</span> ⇒ <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.
Used by Selenium Hooks.</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/testrunner.js.src.html#l420">code »</a><span class="member"><a name="getTestResults">getTestResults</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<<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>A map of test names to a list of
test failures (if any) to provide formatted data for the 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/testrunner.js.src.html#l166">code »</a><span class="member"><a name="hasErrors">hasErrors</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the test case runner has errors that were caught outside of
the test case.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether there were JS errors.</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/testrunner.js.src.html#l100">code »</a><span class="member"><a name="initialize">initialize</a> <span class="args">( testCase )</span></span></div><p>Initializes the test runner.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>testCase: <code class="type"><a href="class_goog_testing_TestCase.html">goog.testing.TestCase</a></code><dd>The test case to initialize with.</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/testrunner.js.src.html#l144">code »</a><span class="member"><a name="isFinished">isFinished</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the test runner is finished.
Used by Selenium Hooks.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether the test runner is active.</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/testrunner.js.src.html#l134">code »</a><span class="member"><a name="isInitialized">isInitialized</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the test runner is initialized.
Used by Selenium Hooks.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether the test runner is active.</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/testrunner.js.src.html#l124">code »</a><span class="member"><a name="isStrict">isStrict</a> <span class="args">( )</span> ⇒ <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 runner should fail on an empty
test case.</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/testrunner.js.src.html#l156">code »</a><span class="member"><a name="isSuccess">isSuccess</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the test case didn't fail.
Used by Selenium Hooks.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether the current test returned successfully.</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/testrunner.js.src.html#l407">code »</a><span class="member"><a name="log">log</a> <span class="args">( s )</span></span></div><p>Logs a message to the current test case.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The text to output to the 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/testrunner.js.src.html#l176">code »</a><span class="member"><a name="logError">logError</a> <span class="args">( msg )</span></span></div><p>Logs an error that occurred. Used in the case of environment setting up
an onerror handler.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>msg: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Error message.</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/testrunner.js.src.html#l187">code »</a><span class="member"><a name="logTestFailure">logTestFailure</a> <span class="args">( ex )</span></span></div><p>Log failure in current running test.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>ex: <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>Exception.</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/testrunner.js.src.html#l275">code »</a><span class="member"><a name="onComplete_">onComplete_</a> <span class="args">( )</span></span></div><p>Writes the results to the document when the test case completes.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l203">code »</a><span class="member"><a name="setErrorFilter">setErrorFilter</a> <span class="args">( fn )</span></span></div><p>Sets a function to use as a filter for errors.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type">function(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code><dd>Filter function.</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/testrunner.js.src.html#l115">code »</a><span class="member"><a name="setStrict">setStrict</a> <span class="args">( strict )</span></span></div><p>By default, the test runner is strict, and fails if it runs an empty
test case.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>strict: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>Whether the test runner should fail on an empty
test case.</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/testrunner.js.src.html#l312">code »</a><span class="member"><a name="writeLog">writeLog</a> <span class="args">( log )</span></span></div><p>Writes a nicely formatted log out to the document.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>log: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to write.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l85">code »</a><span class="member"><a name="errorFilter_">errorFilter_</a> : <code class="type">?(function(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>))</code></span></div><p>Function to use when filtering errors.</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l54">code »</a><span class="member"><a name="errors">errors</a> : <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div><p>Errors that occurred in the window.</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l69">code »</a><span class="member"><a name="initialized">initialized</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>Whether the test runner has been initialized yet.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l77">code »</a><span class="member"><a name="logEl_">logEl_</a> : <code class="type"><a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-745549614">Element</a></code></span></div><p>Element created in the document to add test results to.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l93">code »</a><span class="member"><a name="strict_">strict_</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>Whether an empty test case counts as an error.</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/testing/testrunner.js.src.html#l62">code »</a><span class="member"><a name="testCase">testCase</a> : <code class="type">?<a href="class_goog_testing_TestCase.html">goog.testing.TestCase</a></code></span></div><p>Reference to the active test case.</summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>Loading</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>Loading</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>Loading</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>