0.0.10 • Published 8 years ago

test-http-performance v0.0.10

Weekly downloads
12
License
MIT
Repository
github
Last release
8 years ago

test-http-performance

Node.js mocha friendly http performance scenario test API

Code Example

request data

requests are stored as simple objects that can return json that will work with the request module

var request = request_dto('GET','www.example.com','/index.html');
request.get_request();

get_request will return

{
    method: 'GET',
    uri: 'www.example.com/index.html',
    qs: {},
    headers: [],
    body: ''
}

scenarios

To combine requests in certain orders we add them to a scenario.

var requests = [request_dto('GET','www.example.com','/login.html'),
                request_dto('GET','www.example.com','/index.html'),
                request_dto('GET','www.example.com','/logout.html')];
var example_scenario = scenario(requests);

to run a single scenario you can just call the run function on it

example_scenario.run( function(scenario_results) {
    //e. g. using assert to test it
    assert.equal(true,scenario_results.success);
});

performance_test example with default settings

Here is a minimal setup to run a performance test with everything set to default(not recomended)

var scenario_test = scenario([request_dto('GET','http://localhost:'+some_free_port)]);
var performance_test = performance_test([scenario_test]);
performance_test.run(
    { 
        max_mean_time_msec : 100,
        max_median_time_msec : 100,
        max_time_msec : 150 
    },
    function(test_result) {
        assert.equal(true,test_result.success);
        done();
    }
);

Motivation

test-http-performance was created because there were no modules for node that could be easily configured to do more advanced combinations of requests. The idea is to provide a tool that can setup multiple simulated clients to run secarios consisting of a combination of request that will simulate intended use during a performance test. The test will result in some test data being gathered, the data can then be tested against a set of requirements.

Installation

For now clone it: https://github.com/MatsN/test-http-performance/archive/master.zip or download zip: https://github.com/MatsN/test-http-performance.git

Available npm soon!

API Reference

TODO

Tests

npm test

Contributors

Mats Nilsson

License

MIT

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago