Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

governify-tester

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

governify-tester

Testing endpoints via http requests

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

alt build:passed

1. Install the package

npm install governify-tester --save

2. Install the governify-cli and use it in your shell

npm install governify-cli -g

see doc

3. Use from code

Import library in you code

var tester = require("governify-tester");
  • All results generate a logfile into the directory where is launched.
  • Also you can obtain the results of each test. It is because all methods return a Promises

3.1 Simple requests with duration

  • Params: URL, method , number of times, duration [body], [headers]
tester.doParallelRequestWithDuration("https://www.google.es/", "GET", 2, 1);

If you need the result, you can use the method then because it's a promise

tester.doParallelRequestWithDuration("https://www.google.es/", "GET", 2, 1).then(function(success) {
    console.log(success);
});

  • You can pass body for test. Only you need to pass body like a string.
  • You could also pass headers in next params

lib.doParallelRequestWithDuration("https://jsonplaceholder.typicode.com/posts", "POST", 2, 1, "{	\"isagroup\": 1}");

3.2 Simple requests once

You only test endpoint n times once.

  • Params: URL, method , number of times, [body], [headers]

tester.doOneStackOfRequest("http://google.es", "GET",2);

It is also possible to pass body and headers in the same order that the first one.

3.3 Simple requests infinite

This one is special because not return any result a need that you stop it.

  • Params: URL, method , number of times, [body], [headers]

tester.doRequests("http://google.es", "GET", 2);


3.4 Read test from file

This options is strict. It only has certain types that will be described below. You must write in yaml format and you only have to indicate the path of file.

  • Params: Path
tester.doParallelRequestFromfile('./test.yaml');

Types of tests for config file

  • long
testId: idoftest
type: long
url : https://twitter.com/
duration: 3 #seconds
count: 2 #number of times
method: GET
  • interval

You have to define intervals a its duration necessarily.

testId: validation14
type: interval
url: http://localhost:3000/test
request:
  method: POST
  headers:
    content-type: application/json
    heade1: val
  body:
    id: MyID
    value: XXX
tenants:
  - id: t1
    intervals:
      - 8
      - 5
    duration: 1
  - id: t2
    intervals:
      - 6
      - 4
    duration: 1
  - id: t3
    intervals:
      - 1
      - 8
    duration: 1
  - id: t4
    intervals:
      - 3
      - 3
    duration: 1
  • random

You need to write an array within the body

testId: validation12
type: random
url : https://jsonplaceholder.typicode.com/posts
duration: 4 #seconds
count: 10
request:
  method: POST
  headers:
    content-type: application/json
  body: #randomize in body
    id:
      - prueba
      - prueba1
      - prueba2
      - prueba3
      - prueba4
    value:
      - value
      - value1
      - value2
      - value3
      - value4
    date:
      - Date #currently date

  • randomTemplate
testId: validation11
type: randomTemplate
url : https://jsonplaceholder.typicode.com/posts
duration: 4 #seconds
count: 10
request:
  method: POST
  randomFields:
    id:
      - prueba
      - prueba1
      - prueba2
      - prueba3
      - prueba4
    value:
      - value
      - value1
      - value2
      - value3
      - value4
    date:
      - Date #currently date
  headers:
    content-type: application/json
    #randomize in body
  body: >
          {
          "id": "{{id}}",
          "value": "{{value}}",
          "date": "{{date}}"
          }

Latest release

The version 0.0.2 is the latest stable version of governify-tester component. see release note for details.

For running:

  • Download latest version from 0.0.2

Keywords

FAQs

Package last updated on 28 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc