0.3.0 • Published 2 years ago

http-load-test v0.3.0

Weekly downloads
5
License
ISC
Repository
github
Last release
2 years ago

http-load-test (Alpha)

npm version

Complete endpoint load test.

Installation

Choose to favorite package manager and install http-load-test package.

npm install http-load-test

or

yarn install http-load-test

Basic Usage

const HttpLoadTest = require('http-load-test');

let job = new HttpLoadTest({
  url: 'http://localhost:8001/test', // Enpoint Url
  totalRequest: 10, // How many request what you want as TOTAL
  psRequest: 1, // How many request you want for PER SECOND
  method: 'post', // Http methods
  data: { // Body
    test: "test2"
  },
  headers: {
    'CustomHeaderKey': 'CustomHeaderValue',
    'content-type': 'application/json', 
  },
  requestConfig: { // All axios request configs can apply here 
    responseType: 'json',
  }
})

job.startTest(); // For starting to http load test.

Methods

setRequestSuccessChecker

If result success related response's body, or status code, setRequestSuccessChecker method can be used for purpose.

Example:

httpLoadInstance.setRequestSuccessChecker((response) => {
  try {
    if (response.data.dc === 'Success') {
      return true;
    }
  } catch {
    return false;
  }
  return false;
});

setDynamicDataFunction

With this method, different data can be generated for each request.

httpLoadInstance.setDynamicDataFunction(() => ( {
  test: Date.now().toString()
}));

##TODO's

If you want to contribute feel to free for join. Open issue.

  • Support other http methods.
  • Body and header append
  • Allow to all axios options.
  • Custom success response function
  • Advanced statistics such as http ms, total time etc.
  • Handling all error codes and append total report
0.3.0

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

3 years ago

0.0.4

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago