syntest

0.4.3 • Public • Published

The module for synthetic tests.

It is ready to use with any NodeJS based web server (Express 4.x is recommended).

To use the module, simply install the package via npm

npm install syntest

Then import to your project:

syntest = require('./modules/syntest');

You are now ready to initialize tests. Start with creating new instance of class passing tests config file (schema described below).

let tests = new syntest('requests.json');

Now you can trigger tests:

tests.init();

At this moment, following file structure is required by the module:

folder
-- config
    -- requests.json

The schema of config file:

HTTP

{
  "name": String,
  "type": String ("HTTP"),
  "method": String,
  "url": String,
  "headers": Object,
  "interval": Number (milliseconds),
  "timeout": Number (miliseconds)
 }

RPC

{
  "name": String,
  "type": String ("RPC"),
  "url": String,
  "method": String,
  "params": Object,
  "interval": Number (miliseconds),
  "timeout": Number (miliseconds)
 }

With syntest module you can use Postman exported config file to make synthetic requests (using Newman module). Import the file when creating new instance of syntest class. The module itself will do the rest. The interval for these requests is fixed 60000 ms.

Tests are calling back with following console.info:

Type=String Test=String Status=string

You can easy integrate this with Grafana.

Example config below:

Syntest:
- 'Type=@TYPE Test=@TEST Status=@STATUS':
 metrics:
 - count: Syntest.@TYPE.@TEST.@STATUS

Readme

Keywords

Package Sidebar

Install

npm i syntest

Weekly Downloads

0

Version

0.4.3

License

MIT

Last publish

Collaborators

  • admsk2