Testing
Run groups of tests with TESTER() and send virtual requests to your routes with TEST() and ACTION().
There are two tools. TESTER() runs groups of tests in order and stops at the first failure. TEST() sends virtual requests to your routes with ACTION(), without any HTTP connection:
require('total4');
LOAD('config,definitions,schemas,controllers', function() {
TESTER(function(group, start) {
group('Products', function(test) {
test('List', function(next) {
ACTION('GET /api/products/', function(err, response) {
next(err);
});
});
});
start();
});
});TEST() collects many requests and reports the result as an object, as JSON or as an HTML page.