The MooTest system.
MIT License
| mootest.js | The MooTest system. | 
| MooTest | The MooTest namespace. | 
| MooTest. | Exception thrown by tests failed. | 
| Variables | |
| message | The description of the error. | 
| Functions | |
| MooTest. | Adds to every method of the class definition a ‘functionName’ attribute which is the name of the function in the class definition. | 
| MooTest. | A block of tests, either suites or testsets. | 
| Functions | |
| initialize | Create a new test block. | 
| run | Run the test(s) of this test block and report results to a callback function. | 
| _tests | Method to override to return a map between test names and callables; each callable is a test. | 
| _error | Throw a new error caused by a test failed. | 
| MooTest. | A single test set. | 
| Functions | |
| initialize | Create a new TestSet. | 
| assert | Assert a condition. | 
| assertEquals | Assert two values are the same (according to the ‘==’ operator). | 
| assertZero | Assert a value is zero. | 
| assertNotEquals | Assert two values are the same (according to the ‘!=’ operator). | 
| assertGreater | Assert the first value is greater than the second (according to the ‘>’ operator). | 
| assertGreaterOrEqual | Assert the first value is greater or equal than the second (according to the ‘>=’ operator). | 
| assertLesser | Assert the first value is greater than the second (according to the ‘<’ operator). | 
| assertLesserOrEqual | Assert the first value is greater or equal than the second (according to the ‘<=’ operator). | 
| assertDefined | Assert a value is defined (according to the MooTools ‘$defined’ function; that is, it’s neither null nor undefined). | 
| assertNotDefined | Assert a value is not defined (according to the MooTools ‘$defined’ function; that is, it’s either null or undefined). | 
| assertThrowException | Assert a piece of code throw an exception. | 
| assertThrowNotException | Assert a piece of code throw not an exception. | 
| MooTest. | A suite of tests. | 
| Functions | |
| initialize | Create a new suite. | 
| MooTest. | A test runner. | 
| Functions | |
| run | Run a block of tests, showing the results. | 
| MooTest. | The default test runner for the base test page given in the distribution. | 
Exception thrown by tests failed.
| Variables | |
| message | The description of the error. | 
| Functions | |
| MooTest. | Adds to every method of the class definition a ‘functionName’ attribute which is the name of the function in the class definition. | 
MooTest.ClassEnhancer = function( className, classDefinition ) 
Adds to every method of the class definition a ‘functionName’ attribute which is the name of the function in the class definition. This way the stack trace method can extract a name even for the generated anonymous functions.
| className | The name of the class. | 
| classDefinition | The class definition as should be passed to the Class constructor. | 
A class definition with the function members enriched with a ‘functionName’ attribute.
var MyClass = new Class(MooTest.ClassEnhancer({
    myMethod: function(a, b) { return a+b; }
}));
var m = new MyClass();
alert(m.MyMethod.functionName); // alerts 'myMethod'A block of tests, either suites or testsets. This is a base class for both of Suite and TestSet and serves the purpose to provide the base definitions for both.
| Functions | |
| initialize | Create a new test block. | 
| run | Run the test(s) of this test block and report results to a callback function. | 
| _tests | Method to override to return a map between test names and callables; each callable is a test. | 
| _error | Throw a new error caused by a test failed. | 
run: function( callback ) 
Run the test(s) of this test block and report results to a callback function.
Between the tests you can put special-named elements which are considered separately. These are:
| callback | The callback function; when the test is completed it is called with a dictionary containing the following keys: name (name of the test), success (boolean telling whether test succeeded or not), error (the description of the error as an object containing the keys ‘message’, ‘source’, ‘line’ and ‘stack’); when the test starts is called with the same dictionary where success is null. | 
A single test set. A test set is a set of tests performed on the same data and which can have a setup and tear-down processing for every test.
| Functions | |
| initialize | Create a new TestSet. | 
| assert | Assert a condition. | 
| assertEquals | Assert two values are the same (according to the ‘==’ operator). | 
| assertZero | Assert a value is zero. | 
| assertNotEquals | Assert two values are the same (according to the ‘!=’ operator). | 
| assertGreater | Assert the first value is greater than the second (according to the ‘>’ operator). | 
| assertGreaterOrEqual | Assert the first value is greater or equal than the second (according to the ‘>=’ operator). | 
| assertLesser | Assert the first value is greater than the second (according to the ‘<’ operator). | 
| assertLesserOrEqual | Assert the first value is greater or equal than the second (according to the ‘<=’ operator). | 
| assertDefined | Assert a value is defined (according to the MooTools ‘$defined’ function; that is, it’s neither null nor undefined). | 
| assertNotDefined | Assert a value is not defined (according to the MooTools ‘$defined’ function; that is, it’s either null or undefined). | 
| assertThrowException | Assert a piece of code throw an exception. | 
| assertThrowNotException | Assert a piece of code throw not an exception. | 
A suite of tests. A test suite is a collection of other Suites or TestSets.
| Functions | |
| initialize | Create a new suite. | 
A test runner. This class run a TestBlock (TestSet or Suite) and report results.
| init | Generated at the beginning of the test block run. | 
| testStart | Generated when a test is started; has the name of the test as argument. | 
| testPassed | Generated when a test pass; has the name of the test as argument. | 
| testFailed | Generated when a test fail; has the following arguments: the name of the test, the error description, the source file/url where the error happened, the line at which the error happened, the full stack. | 
| dispose | Generated at the end of the test block. | 
Adds to every method of the class definition a ‘functionName’ attribute which is the name of the function in the class definition.
MooTest.ClassEnhancer = function( className, classDefinition ) 
Create a new test block.
initialize: function() 
Run the test(s) of this test block and report results to a callback function.
run: function( callback ) 
Method to override to return a map between test names and callables; each callable is a test.
_tests: function() 
Throw a new error caused by a test failed.
_error: function( description ) 
Create a new TestSet.
initialize: function( tests ) 
Assert a condition.
assert: function( condition, message ) 
Assert two values are the same (according to the ‘==’ operator).
assertEquals: function( v1, v2, message ) 
Assert a value is zero.
assertZero: function( v, message ) 
Assert two values are the same (according to the ‘!=’ operator).
assertNotEquals: function( v1, v2, message ) 
Assert the first value is greater than the second (according to the ‘>’ operator).
assertGreater: function( v1, v2, message ) 
Assert the first value is greater or equal than the second (according to the ‘>=’ operator).
assertGreaterOrEqual: function( v1, v2, message ) 
Assert the first value is greater than the second (according to the ‘<’ operator).
assertLesser: function( v1, v2, message ) 
Assert the first value is greater or equal than the second (according to the ‘<=’ operator).
assertLesserOrEqual: function( v1, v2, message ) 
Assert a value is defined (according to the MooTools ‘$defined’ function; that is, it’s neither null nor undefined).
assertDefined: function( v, message ) 
Assert a value is not defined (according to the MooTools ‘$defined’ function; that is, it’s either null or undefined).
assertNotDefined: function( v, message ) 
Assert a piece of code throw an exception.
assertThrowException: function( f, message ) 
Assert a piece of code throw not an exception.
assertThrowNotException: function( f, message ) 
Create a new suite.
initialize: function( testBlocks ) 
Run a block of tests, showing the results.
run: function( testBlock )