The Test class is the super class of other test classes including: Test.Unit, Test.Functional, and Test.Controller. Typically Test is not used directly but its functions are available in inheriting classes.
new MVC.Test(name, tests, type) -> Test
Creates a new test case. A test case is a collection of test functions and helpers.
new MVC.Test('TestCaseName',{
test_some_asserts : function(){
var value = this.my_helper('hello world')
this.assert(value) //passes
},
my_helper : function(value){
return value == 'hello world'
}
}, 'unit')
fail()
Adds to the test case's failure count.
helpers()
Returns an object of helper functions that will be used to generate a new Assertion class for the TestCase. The base implementation returns all functions provided to tests in the constructor that do not start with test. Functional and Controller tests overwrite this function.
run(callback)
Runs all the testcase's tests and when complete calls an optional callback if provided.
run_helper(helper_name)
Runs a helper function.
run_test(test_name)
Runs the test specified by the given test_name.
toElement()
Returns an HTMLElement that is the graphical representation of this test.