Simple RESTful flow testing tool
$ git clone https://github.com/qeekin/RESTesting.git
$ cd tester && npm install
$ npm link
$ tester
- Only Accept json files which types are single scenario.
$ tester -d <path>/tester_config/
- Only Accept json files which types are single scenario.
// single scenario
$ tester -f <path>/scenario.json
// multiple scenarios
$ tester -m <path>/scenarios.json
$ tester gen <url> -o <output.json>
- output file name must be suffixes with
.json
Usage: tester [options] <File/Folder>
Commands:
gen [options] <url> Create a json file from the url
Options:
-h, --help output usage information
-V, --version output the version number
-f, --file <File> Specify an alternate json file
-m, --multi <File> Specify an alternate json file with multi scenarios
-d, --directory <Dir> Specify an alternate directory
$ cd <path>/tester && npm unlink
$ rm -r <path>/tester
- Default folder:
tester_config/
- Format: read
- case_short.json (single scenario, use
-f
) - case_multi.json(multiple scenarios, use
-m
)
- case_short.json (single scenario, use
Options of
request
module will all be accepted.
url
: request urlmethod
: (default: GET)headers
: http headersjson
: input jsonqs
: query stringoptions
: About testing configurationname
: Custom name of taskdelay
: (default: 0ms)retry
: (default: 0)interval
: (default: 2000ms)timeout
: set timeout for each task (default: by formula, depends on delay, retry times and interval)
-
statusCode
: (default: 200) -
json
: If enables this option, it will try to parse output to JSON format. (default: true) -
callback(err, res, $out, $prev, next)
: Customized expectation. A String likes javascript syntax (without function declaration).// example "callback": "if( $out.total_current == 1 \n&& $out.current[0].id ==3) \n next(); \nelse \n throw \"error\";"
err
: Actually error in the requestres
: Complete response in the request$out
: Result of the response$prev
: Previous result of the responsenext
: Must be called if the task wants to be passed.