node-load-tester
Summary
A load testing server - v0.5.0
Features
- Basic WebUI
- A new session (new set of cookies) is made per sequence
- Control sequence concurrency with
connections
- Control test duration with
duration
- Control number of runs with
runs
- Set custom
headers
- Create a set of
baseUrls
, randomly choosing abaseUrl
to test against - Create a set of
forms
, randomly choosing aform
to POST with - Create response expectations based on status code and body contents
Demo
http://node-load-tester.herokuapp.com
Note: free heroku instances have bandwidth caps
Download
<codeBlock("npm install -g " + name)>
npm install -g load-tester
Usage
load-tester 3000
Basic front-end at: http://localhost:3000
API
POST /job
Create a load test Job
Job
Object Properties
baseUrl
(String) - Target URLbaseUrls
(Array[String]) - Target URLsheaders
(Object) - Header/Value pairs to apply to allRequest
sruns
(Number) - Number of times to run through thesequence
duration
(Number) - Keep running through thesequence
forduration
msconnections
(Number) - Number of HTTP clients (each will run through thesequence
)sequence
(Array[Request
]) - The sequence ofRequest
s to execute (a new cookie jar is created per sequence)
Request
Object Properties
method
(String) - HTTP Method to use (default:"GET"
)path
(String) - URL Path to be appended tobaseUrl
headers
(Object) - Header/Value pairs to apply to thisRequest
(overridesJob
headers
)form
(Object) - Object to application/form encodeforms
(Array[Object]) - Round-robin through objects to application/form encodeexpect
(Object) - Expectation definition objectcode
(Number) - Expect a particular HTTP status code (default:200)contains
(String) - Expect the HTTP body to containmatch
(String) - Expect the HTTP body to matchnew RegExp(match)
Note: There must be one expect
ation
Note: Failed expections are accumulated in the results, e.g:
"errors":
Basic Example
We'll target http://echo.jpillora.com
, run the following sequence:
- GET
/
(home) and expect a200
- Then POST
/api/login
with creds and expect a200
- Then confirm that we just logged in (
/test/user
and check it's200
) - Then we'll logout
- Finally we'll confirm that we just logged out (
/test/user
and check it's404
)
<showFile("example/basic.json")>
Since http://echo.jpillora.com
is just an echo server, it didn't actually login,
so the second /test/user
still responded with 200, which is seen as a failure:
More Examples
Random form data
<showFile("example/random-forms.json")>
More response expectations
<showFile("example/expectations.json")>
runs
is how many times to run the sequence. Can be used with or instead of duration
.
Simulate load balancer
<showFile("example/load-balancer.json")>
Every request will round-robin through the baseUrls
Requests may also specify a header
object which will override the job's header
object
<license()>
MIT License
Copyright © 2013 Jaime Pillora <dev@jpillora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.