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
3. Use from code
Import library in you code
var 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;
If you need the result, you can use the method then because it's a promise
tester;
- You can pass body for test. Only you need to pass body like a string.
- You could also pass headers in next params
lib;
3.2 Simple requests once
You only test endpoint n times once.
- Params: URL, method , number of times, [body], [headers]
tester;
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;
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;
Types of tests for config file
- #### long
testId: idoftesttype: longurl : https://twitter.com/duration: 3 #seconds count: 2 #number of times method: GET
- #### interval You have to define intervals a its duration necessarily.
testId: validation14type: intervalurl: http://localhost:3000/testrequest: method: POST headers: content-type: application/json heade1: val body: id: MyID value: XXXtenants: - 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: validation12type: randomurl : https://jsonplaceholder.typicode.com/postsduration: 4 #seconds count: 10request: 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: validation11type: randomTemplateurl : https://jsonplaceholder.typicode.com/postsduration: 4 #seconds count: 10request: 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: >
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