loadtest 5.1.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/lib/httpClient.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -651,7 +651,7 @@ loadtest.loadTest(options, function(error) {
|
|
|
651
651
|
|
|
652
652
|
#### `statusCallback`
|
|
653
653
|
|
|
654
|
-
|
|
654
|
+
If present, this function executes after every request operation completes. Provides immediate access to test results while the
|
|
655
655
|
test batch is still running. This can be used for more detailed custom logging or developing your own spreadsheet or
|
|
656
656
|
statistical analysis of results.
|
|
657
657
|
|
|
@@ -692,6 +692,31 @@ loadtest.loadTest(options, function(error) {
|
|
|
692
692
|
});
|
|
693
693
|
```
|
|
694
694
|
|
|
695
|
+
|
|
696
|
+
In some situations request data needs to be available in the statusCallBack.
|
|
697
|
+
This data can be assigned to `request.labels` in the requestGenerator:
|
|
698
|
+
```javascript
|
|
699
|
+
const options = {
|
|
700
|
+
// ...
|
|
701
|
+
requestGenerator: (params, options, client, callback) => {
|
|
702
|
+
// ...
|
|
703
|
+
const randomInputData = Math.random().toString().substr(2, 8);
|
|
704
|
+
const message = JSON.stringify({ randomInputData })
|
|
705
|
+
const request = client(options, callback);
|
|
706
|
+
request.labels = randomInputData;
|
|
707
|
+
request.write(message);
|
|
708
|
+
return request;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
Then in statusCallBack the labels can be accessed through `result.labels`:
|
|
714
|
+
```javascript
|
|
715
|
+
function statusCallback(error, result, latency) {
|
|
716
|
+
console.log(result.labels);
|
|
717
|
+
}
|
|
718
|
+
```
|
|
719
|
+
|
|
695
720
|
**Warning**: The format for `statusCallback` has changed in version 2.0.0 onwards.
|
|
696
721
|
It used to be `statusCallback(latency, result, error)`,
|
|
697
722
|
it has been changed to conform to the usual Node.js standard.
|
package/lib/httpClient.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loadtest",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Run load tests for your web application. Mostly ab-compatible interface, with an option to force requests per second. Includes an API for automated load testing.",
|
|
5
5
|
"homepage": "https://github.com/alexfernandez/loadtest",
|
|
6
6
|
"contributors": [
|