Easy to write, easy to maintain, clutter free :)
declarative-e2e-test
is a Node.js library designed to write e2e tests for any backends in a declarative way.
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:
$ yarn add --save-dev declarative-e2e-test
# or
$ yarn add -D declarative-e2e-test
Using Npm:
$ npm install --save-dev declarative-e2e-test
# or
$ npm i -D declarative-e2e-test
declarative-e2e-test
does not include any testing libraries.
A testing library of the like of Jest, Jasmine or Mocha is required to run the tests.
Please share your feedback and report the encountered issues on the project's issues page.