test framework for restful service, just http test


testful is a node.js test framework for restful service test. Just to give the expect http response, and the http call options. It will test for you, compare the expect result & actual result.

What you need to do is to construct the test data for http request.


With npm, just do:

npm install -g testful

or clone this project on github:

git clone https://github.com/codelint/testful.git

To run the sample test case: just do:



// file[./sample/get_post_timeout.js] is a sample 
// ---------------------------- test cases defines --------------------------- // 
//input & expect is require 
var Cases = {
  "test1 title": {
    result: true / false        //after test will fill by tester 
      host: "localhost",      //optional 
      port: 5555,             //optional 
      method: "POST"/"GET",
      body:{}                 //for post 
      statusCode: 200,
    actual: {                   //after test will fill by tester 
      statusCode: 200,
      headers: {},
      body: {}
    error: {                    //if error occur during testing, tester will fill this field 
    before: Function(next, title, case),          //optional 
    after: Function(next, title, case),           //optional 
    setup: Function(next, title, case),           //optional 
    teardown: Function(next, title, case)         //optional 
  "test2 title": { ... }
// file[./sample/server.context.json] is a sample 
// ------- test server's context ------------ // 
var context = {
  //if give the server, tester will start server auto; 
  //if not give, you must confirm the host:port you give is startup 
  server: nodejs-server,
  host: 'localhost',
  port: 5555,
  timeout: 500,
  encoding: 'utf8'
// init : function(next, cases), 
// close : function(next, cases) 

contact author

nick: DGMan
email: codelint@foxmail.com