This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
42 lines (38 loc) · 1.72 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const fs = require('fs');
module.exports = async ({github, context, core}) => {
const pomPath = process.env.TEST_PATH
const lastRuns = fs.readFileSync(`${pomPath}/target/gatling/lastRun.txt`).toString().trim().split('\n');
for(const run of lastRuns) {
const results = JSON.parse(fs.readFileSync(`${pomPath}/target/gatling/${run}/js/stats.json`).toString());
let tableContent = [
[
{data: 'Request', header: true},
{data: 'Success ✅', header: true},
{data: 'Errors ❌', header: true},
{data: 'Min', header: true},
{data: 'Max', header: true},
{data: 'Avg.', header: true},
{data: 'Std. Dev.', header: true},
{data: 'RPS', header: true},
]
];
for(const result in results.contents) {
const requestMetrics = results.contents[result].stats;
tableContent.push([
requestMetrics.name,
requestMetrics.numberOfRequests.ok.toString(),
requestMetrics.numberOfRequests.ko.toString(),
requestMetrics.minResponseTime.total.toString(),
requestMetrics.maxResponseTime.total.toString(),
requestMetrics.meanResponseTime.total.toString(),
requestMetrics.standardDeviation.total.toString(),
requestMetrics.meanNumberOfRequestsPerSecond.total.toString(),
]);
}
await core.summary
.addHeading(`Results for ${run}`)
.addTable(tableContent)
.addQuote('All times are in millisecond (ms). RPS means "Requests per Second"')
.write()
}
}