k6-cucumber-steps 1.1.3 → 1.1.5
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 +17 -18
- package/bin/k6-cucumber-steps.js +57 -132
- package/package.json +23 -19
- package/scripts/linkReports.js +41 -44
- package/step_definitions/load_test_steps.js +15 -11
- package/.env +0 -38
- package/.github/workflows/k6-load-test.yml +0 -42
- package/.vscode/extensions.json +0 -3
- package/.vscode/settings.json +0 -13
- package/assets/k6-cucumber-report.png +0 -0
- package/assets/k6-cucumber-report2.png +0 -0
- package/assets/paschal logo (2).png +0 -0
- package/cucumber.js +0 -17
- package/reports/cucumber-report.html +0 -50
- package/reports/load-report.json +0 -294
- package/temp/load_script_6ae38e6d-f93e-443a-a516-587047b1f46b.js +0 -65
package/reports/load-report.json
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"description": "",
|
|
4
|
-
"elements": [
|
|
5
|
-
{
|
|
6
|
-
"description": "",
|
|
7
|
-
"id": "rate-limit-enforcement-for-/login-and-/bsp;i-run-the-k6-script-for-load-testing-with-dynamic-get-requests",
|
|
8
|
-
"keyword": "Scenario Outline",
|
|
9
|
-
"line": 44,
|
|
10
|
-
"name": "I run the k6 script for load testing with dynamic GET requests",
|
|
11
|
-
"steps": [
|
|
12
|
-
{
|
|
13
|
-
"arguments": [],
|
|
14
|
-
"keyword": "Given ",
|
|
15
|
-
"line": 5,
|
|
16
|
-
"name": "I login via POST to \"/api/v3/client/api/login\" with payload from \"login.json\"",
|
|
17
|
-
"match": {
|
|
18
|
-
"location": "step_definitions/load_test_steps.js:262"
|
|
19
|
-
},
|
|
20
|
-
"result": {
|
|
21
|
-
"status": "failed",
|
|
22
|
-
"duration": 780541,
|
|
23
|
-
"error_message": "Error: Payload file not found: /Users/paschal/personal/k6-cucumber-steps/payloads/login.json\n at CustomWorld.<anonymous> (/Users/paschal/personal/k6-cucumber-steps/step_definitions/load_test_steps.js:270:13)"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"arguments": [],
|
|
28
|
-
"keyword": "Then ",
|
|
29
|
-
"line": 6,
|
|
30
|
-
"name": "I store the value at \"data.token\" as alias \"auth_token\"",
|
|
31
|
-
"match": {
|
|
32
|
-
"location": "step_definitions/load_test_steps.js:237"
|
|
33
|
-
},
|
|
34
|
-
"result": {
|
|
35
|
-
"status": "skipped",
|
|
36
|
-
"duration": 0
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"arguments": [],
|
|
41
|
-
"keyword": "Given ",
|
|
42
|
-
"line": 30,
|
|
43
|
-
"name": "I set a k6 script for GET testing",
|
|
44
|
-
"match": {
|
|
45
|
-
"location": "step_definitions/load_test_steps.js:28"
|
|
46
|
-
},
|
|
47
|
-
"result": {
|
|
48
|
-
"status": "skipped",
|
|
49
|
-
"duration": 0
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"arguments": [
|
|
54
|
-
{
|
|
55
|
-
"rows": [
|
|
56
|
-
{
|
|
57
|
-
"cells": [
|
|
58
|
-
"virtual_users",
|
|
59
|
-
"duration",
|
|
60
|
-
"http_req_failed",
|
|
61
|
-
"http_req_duration"
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"cells": [
|
|
66
|
-
"10",
|
|
67
|
-
"5",
|
|
68
|
-
"rate<0.05",
|
|
69
|
-
"p(95)<5000"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
"keyword": "When ",
|
|
76
|
-
"line": 31,
|
|
77
|
-
"name": "I set to run the k6 script with the following configurations:",
|
|
78
|
-
"match": {
|
|
79
|
-
"location": "step_definitions/load_test_steps.js:40"
|
|
80
|
-
},
|
|
81
|
-
"result": {
|
|
82
|
-
"status": "skipped",
|
|
83
|
-
"duration": 0
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"arguments": [
|
|
88
|
-
{
|
|
89
|
-
"content": "/get?foo1=bar1&foo2=bar2\nhttps://postman-echo.com/get?foo1=bar1&foo2=bar2",
|
|
90
|
-
"line": 35
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
"keyword": "And ",
|
|
94
|
-
"line": 34,
|
|
95
|
-
"name": "I set the following endpoints used:",
|
|
96
|
-
"match": {
|
|
97
|
-
"location": "step_definitions/load_test_steps.js:145"
|
|
98
|
-
},
|
|
99
|
-
"result": {
|
|
100
|
-
"status": "skipped",
|
|
101
|
-
"duration": 0
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"arguments": [],
|
|
106
|
-
"keyword": "When ",
|
|
107
|
-
"line": 39,
|
|
108
|
-
"name": "I set the authentication type to \"none\"",
|
|
109
|
-
"match": {
|
|
110
|
-
"location": "step_definitions/load_test_steps.js:226"
|
|
111
|
-
},
|
|
112
|
-
"result": {
|
|
113
|
-
"status": "skipped",
|
|
114
|
-
"duration": 0
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"arguments": [],
|
|
119
|
-
"keyword": "Then ",
|
|
120
|
-
"line": 40,
|
|
121
|
-
"name": "I see the API should handle the GET request successfully",
|
|
122
|
-
"match": {
|
|
123
|
-
"location": "step_definitions/load_test_steps.js:306"
|
|
124
|
-
},
|
|
125
|
-
"result": {
|
|
126
|
-
"status": "skipped",
|
|
127
|
-
"duration": 0
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
"tags": [
|
|
132
|
-
{
|
|
133
|
-
"name": "@rate-limit",
|
|
134
|
-
"line": 1
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"name": "@get",
|
|
138
|
-
"line": 28
|
|
139
|
-
}
|
|
140
|
-
],
|
|
141
|
-
"type": "scenario"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"description": "",
|
|
145
|
-
"id": "rate-limit-enforcement-for-/login-and-/bsp;i-run-the-k6-script-for-load-testing-with-dynamic-get-requests",
|
|
146
|
-
"keyword": "Scenario Outline",
|
|
147
|
-
"line": 45,
|
|
148
|
-
"name": "I run the k6 script for load testing with dynamic GET requests",
|
|
149
|
-
"steps": [
|
|
150
|
-
{
|
|
151
|
-
"arguments": [],
|
|
152
|
-
"keyword": "Given ",
|
|
153
|
-
"line": 5,
|
|
154
|
-
"name": "I login via POST to \"/api/v3/client/api/login\" with payload from \"login.json\"",
|
|
155
|
-
"match": {
|
|
156
|
-
"location": "step_definitions/load_test_steps.js:262"
|
|
157
|
-
},
|
|
158
|
-
"result": {
|
|
159
|
-
"status": "failed",
|
|
160
|
-
"duration": 92582,
|
|
161
|
-
"error_message": "Error: Payload file not found: /Users/paschal/personal/k6-cucumber-steps/payloads/login.json\n at CustomWorld.<anonymous> (/Users/paschal/personal/k6-cucumber-steps/step_definitions/load_test_steps.js:270:13)"
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"arguments": [],
|
|
166
|
-
"keyword": "Then ",
|
|
167
|
-
"line": 6,
|
|
168
|
-
"name": "I store the value at \"data.token\" as alias \"auth_token\"",
|
|
169
|
-
"match": {
|
|
170
|
-
"location": "step_definitions/load_test_steps.js:237"
|
|
171
|
-
},
|
|
172
|
-
"result": {
|
|
173
|
-
"status": "skipped",
|
|
174
|
-
"duration": 0
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"arguments": [],
|
|
179
|
-
"keyword": "Given ",
|
|
180
|
-
"line": 30,
|
|
181
|
-
"name": "I set a k6 script for GET testing",
|
|
182
|
-
"match": {
|
|
183
|
-
"location": "step_definitions/load_test_steps.js:28"
|
|
184
|
-
},
|
|
185
|
-
"result": {
|
|
186
|
-
"status": "skipped",
|
|
187
|
-
"duration": 0
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"arguments": [
|
|
192
|
-
{
|
|
193
|
-
"rows": [
|
|
194
|
-
{
|
|
195
|
-
"cells": [
|
|
196
|
-
"virtual_users",
|
|
197
|
-
"duration",
|
|
198
|
-
"http_req_failed",
|
|
199
|
-
"http_req_duration"
|
|
200
|
-
]
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"cells": [
|
|
204
|
-
"5",
|
|
205
|
-
"2",
|
|
206
|
-
"rate<0.05",
|
|
207
|
-
"p(95)<5000"
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
]
|
|
211
|
-
}
|
|
212
|
-
],
|
|
213
|
-
"keyword": "When ",
|
|
214
|
-
"line": 31,
|
|
215
|
-
"name": "I set to run the k6 script with the following configurations:",
|
|
216
|
-
"match": {
|
|
217
|
-
"location": "step_definitions/load_test_steps.js:40"
|
|
218
|
-
},
|
|
219
|
-
"result": {
|
|
220
|
-
"status": "skipped",
|
|
221
|
-
"duration": 0
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"arguments": [
|
|
226
|
-
{
|
|
227
|
-
"content": "/get?foo1=bar1&foo2=bar2\nhttps://postman-echo.com/get?foo1=bar1&foo2=bar2",
|
|
228
|
-
"line": 35
|
|
229
|
-
}
|
|
230
|
-
],
|
|
231
|
-
"keyword": "And ",
|
|
232
|
-
"line": 34,
|
|
233
|
-
"name": "I set the following endpoints used:",
|
|
234
|
-
"match": {
|
|
235
|
-
"location": "step_definitions/load_test_steps.js:145"
|
|
236
|
-
},
|
|
237
|
-
"result": {
|
|
238
|
-
"status": "skipped",
|
|
239
|
-
"duration": 0
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
"arguments": [],
|
|
244
|
-
"keyword": "When ",
|
|
245
|
-
"line": 39,
|
|
246
|
-
"name": "I set the authentication type to \"none\"",
|
|
247
|
-
"match": {
|
|
248
|
-
"location": "step_definitions/load_test_steps.js:226"
|
|
249
|
-
},
|
|
250
|
-
"result": {
|
|
251
|
-
"status": "skipped",
|
|
252
|
-
"duration": 0
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"arguments": [],
|
|
257
|
-
"keyword": "Then ",
|
|
258
|
-
"line": 40,
|
|
259
|
-
"name": "I see the API should handle the GET request successfully",
|
|
260
|
-
"match": {
|
|
261
|
-
"location": "step_definitions/load_test_steps.js:306"
|
|
262
|
-
},
|
|
263
|
-
"result": {
|
|
264
|
-
"status": "skipped",
|
|
265
|
-
"duration": 0
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
],
|
|
269
|
-
"tags": [
|
|
270
|
-
{
|
|
271
|
-
"name": "@rate-limit",
|
|
272
|
-
"line": 1
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"name": "@get",
|
|
276
|
-
"line": 28
|
|
277
|
-
}
|
|
278
|
-
],
|
|
279
|
-
"type": "scenario"
|
|
280
|
-
}
|
|
281
|
-
],
|
|
282
|
-
"id": "rate-limit-enforcement-for-/login-and-/bsp",
|
|
283
|
-
"line": 2,
|
|
284
|
-
"keyword": "Feature",
|
|
285
|
-
"name": "Rate Limit Enforcement for /login and /bsp",
|
|
286
|
-
"tags": [
|
|
287
|
-
{
|
|
288
|
-
"name": "@rate-limit",
|
|
289
|
-
"line": 1
|
|
290
|
-
}
|
|
291
|
-
],
|
|
292
|
-
"uri": "features/bsp.feature"
|
|
293
|
-
}
|
|
294
|
-
]
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import http from 'k6/http';
|
|
3
|
-
import { check } from 'k6';
|
|
4
|
-
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
|
|
5
|
-
import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.1/index.js";
|
|
6
|
-
|
|
7
|
-
export const options = {
|
|
8
|
-
"vus": 10,
|
|
9
|
-
"duration": "5s",
|
|
10
|
-
"thresholds": {
|
|
11
|
-
"http_req_failed": [
|
|
12
|
-
"rate<0.05"
|
|
13
|
-
],
|
|
14
|
-
"http_req_duration": [
|
|
15
|
-
"p(95)<5000"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default function () {
|
|
21
|
-
const headers = {
|
|
22
|
-
"Content-Type": "application/json"
|
|
23
|
-
};
|
|
24
|
-
const body = undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const resolvedUrl0 = "https://sandbox-decide-api.indicina.net/get?foo1=bar1&foo2=bar2";
|
|
28
|
-
const res0 = http.request("GET", resolvedUrl0, null, { headers });
|
|
29
|
-
console.log(`Response Body for ${resolvedUrl0}: ${res0.body}`);
|
|
30
|
-
check(res0, {
|
|
31
|
-
"status is 2xx": (r) => r.status >= 200 && r.status < 300
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const resolvedUrl1 = "https://postman-echo.com/get?foo1=bar1&foo2=bar2";
|
|
36
|
-
const res1 = http.request("GET", resolvedUrl1, null, { headers });
|
|
37
|
-
console.log(`Response Body for ${resolvedUrl1}: ${res1.body}`);
|
|
38
|
-
check(res1, {
|
|
39
|
-
"status is 2xx": (r) => r.status >= 200 && r.status < 300
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function handleSummary(data) {
|
|
45
|
-
const outputDir = __ENV.REPORT_OUTPUT_DIR || "reports";
|
|
46
|
-
const html = htmlReport(data);
|
|
47
|
-
const cucumberReportFile = "cucumber-report.html";
|
|
48
|
-
const cucumberLink = `
|
|
49
|
-
<div style="text-align:center; margin-top:20px;">
|
|
50
|
-
<a href="${cucumberReportFile}" style="font-size:18px; color:#0066cc;">
|
|
51
|
-
🔗 View Cucumber Test Report
|
|
52
|
-
</a>
|
|
53
|
-
</div>
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
57
|
-
const k6ReportFilename = `${outputDir}/k6-report-${timestamp}.html`;
|
|
58
|
-
|
|
59
|
-
console.log(`📄 K6 HTML report ${k6ReportFilename} generated successfully 👍`);
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
[k6ReportFilename]: html.replace("</body>", `${cucumberLink}</body>`),
|
|
63
|
-
stdout: textSummary(data, { indent: " ", enableColors: true }),
|
|
64
|
-
};
|
|
65
|
-
}
|