# Class goog.testing.TestRunner

code »

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.

## Constructor

goog.testing.TestRunner ( )
Show:Public Protected Private

## Instance Methods

code »execute ( )

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

code »getNumFilesLoaded ( ) ⇒ `number`

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

Returns
The number of script files.

code »getReport ( opt_verbose ) ⇒ `string`

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

Parameters
opt_verbose: `boolean=` If true results will include data about all tests, not just what failed.
Returns
A report summary of the test.

code »getRunTime ( ) ⇒ `number`

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

Returns
The run time, in milliseconds.

code »getTestResults ( ) ⇒ `Object.<string>`

Returns
A map of test names to a list of test failures (if any) to provide formatted data for the test runner.

code »hasErrors ( ) ⇒ `boolean`

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

Returns
Whether there were JS errors.

code »initialize ( testCase )

Initializes the test runner.

Parameters
testCase: `goog.testing.TestCase` The test case to initialize with.

code »isFinished ( ) ⇒ `boolean`

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

Returns
Whether the test runner is active.

code »isInitialized ( ) ⇒ `boolean`

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

Returns
Whether the test runner is active.

code »isStrict ( ) ⇒ `boolean`

Returns
Whether the test runner should fail on an empty test case.

code »isSuccess ( ) ⇒ `boolean`

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

Returns
Whether the current test returned successfully.

code »log ( s )

Logs a message to the current test case.

Parameters
s: `string` The text to output to the log.

code »logError ( msg )

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

Parameters
msg: `string` Error message.

code »logTestFailure ( ex )

Log failure in current running test.

Parameters
ex: `Error` Exception.

code »onComplete_ ( )

Writes the results to the document when the test case completes.

code »setErrorFilter ( fn )

Sets a function to use as a filter for errors.

Parameters
fn: `function(string)` Filter function.

code »setStrict ( strict )

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

Parameters
strict: `boolean` Whether the test runner should fail on an empty test case.

code »writeLog ( log )

Writes a nicely formatted log out to the document.

Parameters
log: `string` The string to write.

## Instance Properties

code »errorFilter_ : `?(function(string))`

Function to use when filtering errors.

code »errors : `Array.<string>`

Errors that occurred in the window.

code »initialized : `boolean`

Whether the test runner has been initialized yet.

code »logEl_ : `Element`

Element created in the document to add test results to.

code »strict_ : `boolean`

Whether an empty test case counts as an error.

code »testCase : `?goog.testing.TestCase`

Reference to the active test case.