Test.Run.Harness - Abstract base class for test harness
var Harness
var isNode = typeof process != 'undefined' && process.pid
if (isNode) {
require('Task/Test/Run/NodeJSBundle')
Harness = Test.Run.Harness.NodeJS
} else
Harness = Test.Run.Harness.Browser.ExtJS
var INC = (isNode ? require.paths : []).concat('../lib', '/jsan')
Harness.configure({
title : 'Sample.Dist Test Suite',
preload : [
"jsan:Task.Joose.Core",
"jsan:Task.JooseX.Namespace.Depended.Auto",
{
text : "use.paths = " + Harness.prepareINC(INC)
}
]
})
Harness.start(
'010_sanity.t.js',
// advanced descriptors for test files
{
url : '020_basic.t.js',
// replace `preload` option of harness
preload : [
"jsan:Task.Joose.Stable",
]
},
{
url : '030_advanced.t.js',
// append to `preload` option of harness
alsoPreload : [
"jsan:Task.Joose.Stable",
],
scopeProvider : 'Scope.Provider.Window' // or just 'Window'
}
)
Test.Run.Harness
is an abstract base harness class in Test.Run hierarchy. This class provides no UI,
you should use one of it subclasses, for example [Test.Run.Harness.Browser.ExtJS]
void configure(Object options)
This method configure the harness instance. It just copies the passed configuration option into static instance.
options - configuration options (values of attributes for this class, see below for details)
void start(String url1, String url2, ...)
This method starts a whole test suite
url1, url2, ... - the variable number of test files urls or, in general case, test files descriptors. Descriptor is an object with the following structure:
{
url : 'test_file_url.t.js',
preload : [], // when given - will replace the `preload` option of harness
alsoPreload : [], // when given - will append to the `preload` option of harness
scopeProvider : 'IFrame' // 'IFrame' is default for Web and 'NodeJS' for server-side
// contains a name of the Scope.Provider class, with which
// the scope of the test will be created
}
See also Scope-Provider
String title
The title of the test suite
Boolean passThroughEx
The sign whether the each tests in suite should re-throw any exceptions caught (sometimes useful for debugging with FireBug). Defaults to 'false'.
Boolean transparentEx
The sign whether the each tests in suite shouldn't catch any exceptions at all. Exceptions will be thrown "as is". This is also useful for debugging. Defaults to 'false'
Boolean keepResults
The sign whether the results of the tests should not be immediately released. Under results here means the final state of the test scope, which may be represented with iframe or browser window.
Array preload
The array which contains the information about which files should be preloaded into each test's scope. The following rules applies during processing of the array:
If the string entry represent a class name (for example :
Test.Run.Test
) it is converting to the url, like "../lib/Test/Run/Test.js"All string entries starting with 'jsan:' are replaced with the link to corresponding JSAN module. For example:
jsan:Task.Joose.Core
If the entry ends with ".js", its supposed to be the url and is passing without modifications.
If the entry is an Object with
text
property, then the value of that property will be evaluted in the test's global scope directly. In this way you can run arbitrary code for setup.
String runCore
Either
parallel
orsequential
. Indicates how the individual tests should be run - several at once or one-by-one.
Number maxThreads
The maximum number of tests running at the same time. Only applicable for
parallel
run-core.
Class testClass
The test class which will be used for running tests, defaults to Test.Run.Test.
General documentation for Joose: http://joose.github.com/Joose/
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at http://github.com/SamuraiJack/test.run/issues
Nickolay Platonov nplatonov@cpan.org
Copyright (c) 2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.