Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gpiechnik2/xk6-httpagg
k6 extension that allows you to aggregate the results of HTTP requests and view them one by one using a generated .html report. Implemented using xk6.
https://github.com/gpiechnik2/xk6-httpagg
aggregate html http k6 k6-extension results xk6
Last synced: 4 months ago
JSON representation
k6 extension that allows you to aggregate the results of HTTP requests and view them one by one using a generated .html report. Implemented using xk6.
- Host: GitHub
- URL: https://github.com/gpiechnik2/xk6-httpagg
- Owner: gpiechnik2
- License: apache-2.0
- Created: 2022-05-26T15:06:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-10T09:39:44.000Z (8 months ago)
- Last Synced: 2024-07-30T21:05:34.935Z (6 months ago)
- Topics: aggregate, html, http, k6, k6-extension, results, xk6
- Language: Go
- Homepage:
- Size: 572 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xk6-httpagg
[k6](https://github.com/grafana/k6) extension that allows you to aggregate the results of HTTP requests and view them one by one using a generated `.html` report. Until now it was only possible to analyze them using [WDP (Web Debugging Proxy)](https://k6.io/blog/k6-load-testing-debugging-using-a-web-proxy/). Implemented using the [xk6](https://github.com/grafana/xk6) system.## Build
```shell
xk6 build --with github.com/gpiechnik2/xk6-httpagg@latest
```
## Example
```javascript
import { check } from 'k6';
import http from 'k6/http';
import httpagg from 'k6/x/httpagg';export default function () {
const response = http.get('http://httpbin.test.k6.io/endpointThatWillReturn404Error');
const status = check(
response,
{
'response code was 200': (res) => res.status == 200
}
); // the status variable will be false because the assertion inside does not matchhttpagg.checkRequest(
response,
status,
{
fileName: "myFilenameWithRequestsAggregated.json",
aggregateLevel: "onSuccess" // response with the request above will not be
// aggregated because we set the aggregation level to "onSuccess".
// The default level is "onError", which is when any of the assertions from
// the k6 "check" function fails and the entire function returns false
}
);// or (without the optional fields)
httpagg.checkRequest(response, status); // this request & response will be aggregated because
// we have not set the aggregation level and the default "onError" will be used. Additionally,
// a file will be created with the default name "httpagg.json"// or
// IMPORTANT: We can use the "all" aggregation level to aggregate all requests regardless of
// the check result
httpagg.checkRequest(response, status, {
aggregateLevel: "all"
});
}export function teardown(data) {
httpagg.generateRaport("myFilenameWithRequestsAggregated.json", "myHtmlReport.html")// or (without the optional fields)
httpagg.generateRaport() // the default name of the html report that will be created
// is "httpaggReport.html". In turn, the name of the request results file that will
// be checked is "httpagg.json"
}
```## Report view
## Run sample script
```shell
./k6 run ./script.js
```