1.1.1222 • Published 3 years ago
testful v1.1.1222
Testful
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.
installation
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:
./do_sample_test
examples
You just give the case data like below:
// 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
input:{
host: "localhost", //optional
port: 5555, //optional
method: "POST"/"GET",
headers:{},
path:"/url/to/call/api?param1=1¶m2=2"
body:{} //for post
},
expect:{
statusCode: 200,
headers:{},
body:{}
},
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
1.0.1222
3 years ago
1.1.1222
3 years ago
1.0.1464
11 years ago
1.0.1463
11 years ago
1.0.1462
11 years ago
1.0.1461
11 years ago
1.0.1460
11 years ago
1.0.1459
11 years ago
1.0.1409
11 years ago
1.0.1457
11 years ago
0.1.965
11 years ago
0.1.964
11 years ago
0.1.937
11 years ago
0.1.384
13 years ago
0.1.378
13 years ago
0.1.377
13 years ago
0.1.376
13 years ago
0.1.375
13 years ago
0.1.374
13 years ago
0.1.337
13 years ago
0.1.335
13 years ago
0.1.327
13 years ago
0.1.321
13 years ago
0.1.320
13 years ago
0.1.10
13 years ago
0.1.319
13 years ago
0.1.8
13 years ago
0.1.7
13 years ago
0.1.6
14 years ago
0.1.5
14 years ago
0.1.4
14 years ago
0.1.3
14 years ago