declarative-e2e-test
Version:
Declaration driven test generator for REST endpoints
85 lines (62 loc) • 2.6 kB
Markdown
Easy to write, easy to maintain, clutter free :)
[](https://travis-ci.org/marc-ed-raffalli/declarative-e2e-test)
[](https://coveralls.io/github/marc-ed-raffalli/declarative-e2e-test?branch=master)
[](https://www.npmjs.com/package/declarative-e2e-test)
[](https://github.com/marc-ed-raffalli/declarative-e2e-test/blob/master/LICENSE)
`declarative-e2e-test` is a Node.js library designed to write e2e tests for any backends in a declarative way.
```typescript
import {api, run, TestRequestSuiteDefinition} from 'declarative-e2e-test';
const exampleTestDefinition: TestRequestSuiteDefinition = {
'Profile API': {
tests: {
'returns user data': {
url: '/user/profile',
headers: {authorization: 'some-auth-token'},
expect: {username: 'johnDoe', role: 'user'}
},
'returns 401 when not authenticated': {
url: '/user/profile',
expect: 401
}
}
}
};
run(exampleTestDefinition, {api: api.jest});
```
- Makes HTTP request from node.js and assert response
- Compatible with major Node testing libraries
- Generates the tests and test suites where the requests are performed
- Flexible response assertion
- status
- headers / payload
- multiple / default
- Test hooks / Skip / Only
- Single request flow / series of requests
- Easy integration with Express application instance
**Using Yarn**:
```bash
$ yarn add --save-dev declarative-e2e-test
$ yarn add -D declarative-e2e-test
```
**Using Npm**:
```bash
$ npm install --save-dev declarative-e2e-test
$ npm i -D declarative-e2e-test
```
`declarative-e2e-test` does not include any testing libraries.
A testing library of the like of [Jest][jest], [Jasmine][jasmine] or [Mocha][mocha] is required to run the tests.
[][projectHomePage]
Please share your feedback and report the encountered issues on the
[][projectIssues].
[]: https://marc-ed-raffalli.github.io/declarative-e2e-test
[]: https://github.com/marc-ed-raffalli/declarative-e2e-test/issues
[]: https://jestjs.io/
[]: https://jasmine.github.io/
[]: https://mochajs.org/