Class webdriver.testing.TestCase
code »goog.testing.TestCase
└ webdriver.testing.TestCaseConstructs a test case that synchronizes each test case with the singleton
webdriver.promise.ControlFlow.
Constructor
| Parameters |
|---|
|
Instance Methods
Defined in webdriver.testing.TestCase
code »cycleTests ( )Executes the next test inside its own webdriver.Application.
webdriver.Application.code »runSingleTest_ ( test, onError ) ⇒ !webdriver.promise.PromiseExecutes a single test, scheduling each phase with the global application.
Each phase will wait for the application to go idle before moving on to the
next test phase. This function models the follow basic test flow:
try {
this.setUp.call(test.scope);
test.ref.call(test.scope);
} catch (ex) {
onError(ex);
} finally {
try {
this.tearDown.call(test.scope);
} catch (e) {
onError(e);
}
}
!webdriver.promise.Promise| Parameters |
|---|
|
| Returns |
|
Defined in goog.testing.TestCase
Adds a new test to the test case.
| Parameters |
|---|
|
code »addNewTest ( name, ref, opt_scope )Creates and adds a new test.
Convenience function to make syntax less awkward when not using automatic
test discovery.
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.
Adds any functions defined in the global scope that are prefixed with "test"
to the test case.
code »clearTimeout ( id )Clears a timeout created by this.timeout().
this.timeout().| Parameters |
|---|
|
Counts the number of files that were loaded for dependencies that are
required to run the test.
| Returns |
|---|
|
code »createTestFromAutoDiscoveredFunction ( name, ref ) ⇒ !goog.testing.TestCase.TestCreates a goog.testing.TestCase.Test from an auto-discovered
function.
!goog.testing.TestCase.Testgoog.testing.TestCase.Test from an auto-discovered
function.| Parameters |
|---|
|
| Returns |
|
Handles a test that failed.
| Parameters |
|---|
|
Handles a test that passed.
| Parameters |
|---|
|
Returns the number of tests actually run in the test case, i.e. subtracting
any which are skipped.
| Returns |
|---|
|
| Returns |
|---|
|
code »getBatchTime ( ) ⇒ number
number| Returns |
|---|
|
code »getGlobals ( opt_prefix ) ⇒ !ArrayGets 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.
!Array| Parameters |
|---|
|
| Returns |
|
Returns the number of script files that were loaded in order to run the test.
| Returns |
|---|
|
code »getRunTime ( ) ⇒ numberReturns the amount of time it took for the test to run.
number| Returns |
|---|
|
code »getTestResults ( ) ⇒ !Object.<string>Returns the test results object: a map from test names to a list of test
failures (if any exist).
!Object.<string>| Returns |
|---|
|
Gets the tests.
| Returns |
|---|
|
code »getTimeStamp_ ( ) ⇒ stringReturns the current time.
string| Returns |
|---|
|
| Returns |
|---|
|
code »maybeFailTestEarly ( testCase ) ⇒ booleanChecks 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.
boolean| Parameters |
|---|
|
| Returns |
|
Returns the current test and increments the pointer.
| Returns |
|---|
|
code »orderTests_ ( tests )Reorders the tests depending on the order field.
order field.| Parameters |
|---|
|
code »saveMessage ( message )Saves a message to the result set.
| Parameters |
|---|
|
code »setBatchTime ( batchTime )
| Parameters |
|---|
|
code »setCompletedCallback ( fn )Sets the callback function that should be executed when the tests have
completed.
| Parameters |
|---|
|
Sets the tests.
| Parameters |
|---|
|
code »shouldRunTests ( ) ⇒ booleanCan 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| Returns |
|---|
|
Gets called after all tests have been executed. Can be overridden to tear
down the entire test case.
Instance Properties
Defined in webdriver.testing.TestCase
Defined in goog.testing.TestCase
Time since the last batch of tests was started, if batchTime exceeds
#maxRunTime a timeout will be used to stop the tests blocking the
browser and a new batch will be started.
#maxRunTime a timeout will be used to stop the tests blocking the
browser and a new batch will be started.