grandma v0.10.0
This is a load testing library and CLI tool. It is inspired by the good parts of Vegeta and JMeter, but hopefully leaves out the bad parts of both.
Install
You can install grandma as a global CLI tool:
npm install grandmaTest files
Here is a quick example of a test file:
module.exports = {
beforeAll: function(done) {
process.nextTick(done);
},
beforeEach: function(done) {
process.nextTick(done);
},
test: function(done) {
process.nextTick(done);
},
afterEach: function(done) {
process.nextTick(done);
},
afterAll: function(done) {
process.nextTick(done);
}
};All functions other than test are optional, and you can exclude them if you do not need them. All functions are asynchronous, and you must call the done callback to continue. For more information about writing tests, see the test files help topic.
CLI
To see the most up-to-date CLI, type:
grandma helpThe following commands are available.
grandma run <testname> --duration=<duration> --rate=<rate> [options]
grandma report [glob=stdin] [options]
grandma list [options]To see help on these commands, you can type one of:
grandma run --help
grandma report --helpThe following options are available as flags (some are only relevant for the run command):
grandma list
Lists all the tests in your test suite. You can use these names in grandma run to run the test. See more information bout it in the granda list CLI page.
grandma run
Run a test named "pineapples" for 10 minutes at a rate of 500 tests per second:
grandma run pineapples --duration 10m --rate 500 --out pineapples.logRun a test named "peaches" for one and a half hours, running 100 concurrent tests:
grandma run peaches --duration 1h30m --concurrent 100 --out peaches.logTo find out more about the CLI, please see the grandma run CLI page.
Note: I will assume that you have configured the test directory in the .grandmarc file, so it was not included it in these examples.
grandma report
Print a plain text report of the previously-described test run:
grandma report pineapples.logYou can also create an HTML page containing an interactive graph of the results:
grandma report pineapples.log --type html --out pineapples.htmlBy default, all reports will print to standard output, unless you specify a file in the --out flag.
You can find more information about the available reports and the data they provide in the grandma report CLI page.
grandma diff
Compares two or more test runs, calculating the difference in timing among them.
grandma diff --logs one.log two.log three.log.grandmarc file
You can set up an RC file to help with managing some of the setting, such as the directory of test files. Here is the content a sample file.
To find out more, see the .grandmarc doc page.
API
Grandma exposes the run and report commands as an API.
var grandma = require('grandma');grandma.run
See more information about using run in the grandma.run API page.
grandma.report
See more information about using report in the grandma.report API page.
6 years ago
6 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago