declarative-e2e-test
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

declarative-e2e-test

Easy to write, easy to maintain, clutter free :)

Build Status Coverage Status NPM version MIT License

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});

Features

  • 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

Installation

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.

Documentation

View project's homepage

Issues

Please share your feedback and report the encountered issues on the project's issues page.

Package Sidebar

Install

npm i declarative-e2e-test

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

35.7 kB

Total Files

41

Last publish

Collaborators

  • marc-ed-raffalli