The goog.testing.TestRunner Class

goog.testing.TestRunner()

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.

.errors {Array.<string>}

Errors that occurred in the window.

.execute()

Executes a test case and prints the results to the window.

.getNumFilesLoaded()

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)

Returns a report of the test case that ran. Used by Selenium Hooks.

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

.getRunTime()

Returns the amount of time it took for the test to run. Used by Selenium Hooks.

returns {number}
The run time, in milliseconds.

.hasErrors()

Returns true if the test case runner has errors that were caught outside of the test case.

returns {boolean}
Whether there were JS errors.

.initialize(testCase)

Initializes the test runner.

testCase {goog.testing.TestCase}
The test case to initialize with.

.initialized {boolean}

Whether the test runner has been initialized yet.

.isFinished()

Returns true if the test runner is finished. Used by Selenium Hooks.

returns {boolean}
Whether the test runner is active.

.isInitialized()

Returns true if the test runner is initialized. Used by Selenium Hooks.

returns {boolean}
Whether the test runner is active.

.isStrict()

returns {boolean}
Whether the test runner should fail on an empty test case.

.isSuccess()

Returns true if the test case didn't fail. Used by Selenium Hooks.

returns {boolean}
Whether the current test returned successfully.

.log(s)

Logs a message to the current test case.

s {string}
The text to output to the log.

.logError(msg)

Logs an error that occurred. Used in the case of environment setting up an onerror handler.

msg {string}
Error message.

.logTestFailure(ex)

Log failure in current running test.

ex {Error}
Exception.

.setErrorFilter(fn)

Sets a function to use as a filter for errors.

fn {function(string)}
Filter function.

.setStrict(strict)

By default, the test runner is strict, and fails if it runs an empty test case.

strict {boolean}
Whether the test runner should fail on an empty test case.

.testCase {goog.testing.TestCase?}

Reference to the active test case.

.writeLog(log)

Writes a nicely formatted log out to the document.

log {string}
The string to write.