rest-bdd-testing
Toolchain for testing REST API, in BDD style.
Installation
rest-bdd-testing
is available on npm. To install it, type:
$ npm install rest-bdd-testing
Usage
Here is sample usage of this package with mocha.
const http = ;const URL = ;const assert = ; ; ;
If autodump
or autodoc
presents, the given.end()
creates 2 files for dumping and documenting given(story);
Dumping Story
The json
file for above story:
Documenting Story
The md
file for above story:
## Happy Scenario
### GET /books/:id/writers/:name
When name is provided, result should be caught.
### Url Parameters
Name | Example
---|---
id | 1
name | john
### Query Strings
Name | Example
---|---
fields | [fullName,age]
sort | -id
### Response: 200
#### Headers
* date: Thu, 18 Apr 2019 21:55:43 GMT
* connection: close
* content-length: 13
#### Body:
Content-Type: application/json
```json
{
"foo": "bar"
}
```
---
## WHEN: Name is null
### GET /books/:id/writers/:name
The name url parameter is null
### Url Parameters
Name | Example
---|---
id | 1
name |
### Response: 404
#### Headers
* date: Thu, 18 Apr 2019 21:55:43 GMT
* connection: close
* transfer-encoding: chunked
#### Body:
Content-Type: text/plain
```
404 Not found
```