Never let your APIs down! Pingster is the tool that allows you test any API requests that are used inside your apps and projects.
npm install pingster
In the root of your project create pingster.yml
file that looks like:
httpbin:
url: https://httpbin.org/get?hello=world
expect:
status: 200
then run command inside your folder:
pingster
and it will test if that url returns 200
as you expect!
Options:
-c, --config optional path to config file wtih .yml ext
-d, --debug, --verbose enable verbose logging mode
-h, --help print help
-v, --version print version
It is also possible to use Pingster inside your code directly:
const pingster = require('pingster');
const config = {
httpbin: {
url: 'https://httpbin.org/get?hello=world'
expect: {
status: 200
}
}
};
pingster.tester(config).then(testResults => {
console.log(testResults);
});
loadConfig(path: String) -> Object
- load and parse YAML config file from specified path and get a config object in returnparseConfig(yaml: String) -> Object
- parse YAML string and get a config object in returntester(config: Object) -> Promise
- run tests on APIs specified in config object, returns a Promise
# api name
httpbin:
# api url that will be tested
url: https://httpbin.org/get?hello=world
# data that will be tested to match with response
expect:
status: 200
data:
foo: bar
num: 123
bool: true
obj:
key: value
headers:
content-type: application/json
Furthermore you can also easily setup and self-host your own Pingster web service that will run API tests of your projects and show the results in beautiful UI. Here are the apps that will help you:
- pingster-server - Node.js backend that provides REST API and scheduled Pingster test runner for your GitHub repositories