Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "loadmill", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A node.js module for running load tests and functional tests on loadmill.com", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# Loadmill | ||
Users of [Loadmill](https://www.loadmill.com) can use this node module to: | ||
1. Run load tests on loadmill.com. | ||
2. Run functional tests on loadmill.com. | ||
3. Do both programmatically or via CLI. | ||
3. Do both programmatically or via [CLI](#cli). | ||
## Installation | ||
Using npm: | ||
@@ -16,3 +18,14 @@ | ||
If you need to run the loadmill CLI outside of an npm script, you may prefer to install this package globally. | ||
Using npm: | ||
`npm install -g loadmill` | ||
Using yarn: | ||
`yarn global add loadmill` | ||
## Usage | ||
The following code runs a very simple load test that gets a single page from `www.myapp.com` every second for one minute: | ||
@@ -31,2 +44,3 @@ ```js | ||
### Test Configuration | ||
The JSON test configuration may be exported from the loadmill test editor or from an old test run. | ||
@@ -36,2 +50,3 @@ Read more about the configuration format [here](https://docs.loadmill.com/test-configurations.html). | ||
### Using Promises | ||
Every function that accepts a callback will return a promise instead if no callback is provided (and vice versa): | ||
@@ -45,2 +60,3 @@ ```js | ||
### Waiting for Tests | ||
Since load tests usually run for at least a few minutes, the loadmill client does not wait for them to finish by default. | ||
@@ -56,2 +72,3 @@ You can explicitly wait for a test to finish using the `wait` function: | ||
### Functional Tests | ||
You may also use a test configuration to run a functional test (i.e. a single iteration of requests) - this is usually useful for testing your API for regressions after every new deployment. | ||
@@ -66,2 +83,3 @@ Functional tests are expected to be shorter and thus are awaited on by default: | ||
### Parameters | ||
You will usually want some part of your test to be _dynamic_, e.g. the host name of the tested server. | ||
@@ -79,2 +97,53 @@ With Loadmill, this is made easy by using [parameters](https://docs.loadmill.com/parameters.html). | ||
## CLI | ||
Coming Soon... | ||
The loadmill command line interface basically wraps the functions provided by the node module: | ||
``` | ||
loadmill <config-file> -t <token> [options] [parameter=value...] | ||
``` | ||
### Functional Tests | ||
The default is to run a functional test: | ||
``` | ||
loadmill test.json --token DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG | ||
``` | ||
Unless the `-q` option is set, the result JSON will be printed to the standard output. | ||
### Load Tests | ||
You may launch a load test by setting the `-l` or `--load-test` option: | ||
``` | ||
loadmill test.json --load-test -t DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG | ||
``` | ||
The load test will be launched and its unique identifier will be printed to the standard output. You may alternatively | ||
set the `-w` or `--wait` option in order to wait for the load test to finish, in which case only the result JSON will be | ||
printed out at the end: | ||
``` | ||
loadmill test.json -lw -t DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG | ||
``` | ||
### Exit Status | ||
Unless the `-n` or `--no-bail` option is set, the CLI process will exit with a nonzero exit code if the test had not passed. | ||
Other errors, such as invalid command line arguments or unavailable network will always give a nonzero exit status. | ||
### Parameters | ||
You may set loadmill parameter values via command line arguments by passing `name=value` pairs: | ||
``` | ||
loadmill parametrized_test.json -t DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG host=test.myapp.com port=4443 | ||
``` | ||
### CLI Options | ||
Full list of command line options: | ||
- `-h, --help` Output usage information. | ||
- `-t, --token <token>` Provide a Loadmill API Token. You must provide a token in order to run tests. | ||
- `-l, --load-test` Launch a load test. If not set, a functional test will run instead. | ||
- `-w, --wait` Wait for the load test to finish. Functional tests are always waited on. | ||
- `-n, --no-bail` Return exit code 0 even if test fails. | ||
- `-q, --quiet` Do not print out anything (except errors). | ||
- `-v, --verbose` Print out extra information for debugging (trumps `-q`). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31981
143