k6-cucumber-steps 1.0.11 → 1.0.13
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/.env +1 -1
- package/bin/k6-cucumber-runner.js +59 -41
- package/cucumber.js +11 -24
- package/lib/helpers/buildK6Script.js +0 -29
- package/lib/utils/k6Runner.js +70 -54
- package/package.json +3 -2
- package/reports/load-results.html +1 -1
- package/reports/load-results.json +16 -14
- package/reports/report.html +13 -57
- package/step_definitions/load_test_steps.js +1 -33
- package/temp/load_script_2a96242d-8924-468d-a0f1-3f9555b4eef1.js +44 -0
- package/temp/load_script_e2119cce-eeb0-4b11-82e1-12f6827d6a82.js +44 -0
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"result": {
|
|
21
21
|
"status": "passed",
|
|
22
|
-
"duration":
|
|
22
|
+
"duration": 676165
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
{
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
},
|
|
56
56
|
"result": {
|
|
57
57
|
"status": "passed",
|
|
58
|
-
"duration":
|
|
58
|
+
"duration": 277249
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"arguments": [
|
|
63
63
|
{
|
|
64
|
-
"content": "/
|
|
64
|
+
"content": "/get?foo1=bar1&foo2=bar2\nhttps://postman-echo.com/get?foo1=bar1&foo2=bar2",
|
|
65
65
|
"line": 38
|
|
66
66
|
}
|
|
67
67
|
],
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"result": {
|
|
75
75
|
"status": "passed",
|
|
76
|
-
"duration":
|
|
76
|
+
"duration": 52750
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
{
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"result": {
|
|
88
88
|
"status": "passed",
|
|
89
|
-
"duration":
|
|
89
|
+
"duration": 86542
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
{
|
|
@@ -98,8 +98,9 @@
|
|
|
98
98
|
"location": "step_definitions/load_test_steps.js:134"
|
|
99
99
|
},
|
|
100
100
|
"result": {
|
|
101
|
-
"status": "
|
|
102
|
-
"duration":
|
|
101
|
+
"status": "failed",
|
|
102
|
+
"duration": 101674709,
|
|
103
|
+
"error_message": "Error: k6 test execution failed\n at CustomWorld.<anonymous> (/Users/paschal/personal/k6-cucumber-steps/step_definitions/load_test_steps.js:154:13)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)"
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
],
|
|
@@ -128,7 +129,7 @@
|
|
|
128
129
|
},
|
|
129
130
|
"result": {
|
|
130
131
|
"status": "passed",
|
|
131
|
-
"duration":
|
|
132
|
+
"duration": 56459
|
|
132
133
|
}
|
|
133
134
|
},
|
|
134
135
|
{
|
|
@@ -164,13 +165,13 @@
|
|
|
164
165
|
},
|
|
165
166
|
"result": {
|
|
166
167
|
"status": "passed",
|
|
167
|
-
"duration":
|
|
168
|
+
"duration": 42250
|
|
168
169
|
}
|
|
169
170
|
},
|
|
170
171
|
{
|
|
171
172
|
"arguments": [
|
|
172
173
|
{
|
|
173
|
-
"content": "/
|
|
174
|
+
"content": "/get?foo1=bar1&foo2=bar2\nhttps://postman-echo.com/get?foo1=bar1&foo2=bar2",
|
|
174
175
|
"line": 38
|
|
175
176
|
}
|
|
176
177
|
],
|
|
@@ -182,7 +183,7 @@
|
|
|
182
183
|
},
|
|
183
184
|
"result": {
|
|
184
185
|
"status": "passed",
|
|
185
|
-
"duration":
|
|
186
|
+
"duration": 24791
|
|
186
187
|
}
|
|
187
188
|
},
|
|
188
189
|
{
|
|
@@ -195,7 +196,7 @@
|
|
|
195
196
|
},
|
|
196
197
|
"result": {
|
|
197
198
|
"status": "passed",
|
|
198
|
-
"duration":
|
|
199
|
+
"duration": 120874
|
|
199
200
|
}
|
|
200
201
|
},
|
|
201
202
|
{
|
|
@@ -207,8 +208,9 @@
|
|
|
207
208
|
"location": "step_definitions/load_test_steps.js:134"
|
|
208
209
|
},
|
|
209
210
|
"result": {
|
|
210
|
-
"status": "
|
|
211
|
-
"duration":
|
|
211
|
+
"status": "failed",
|
|
212
|
+
"duration": 27540708,
|
|
213
|
+
"error_message": "Error: k6 test execution failed\n at CustomWorld.<anonymous> (/Users/paschal/personal/k6-cucumber-steps/step_definitions/load_test_steps.js:154:13)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)"
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
],
|
package/reports/report.html
CHANGED
|
@@ -345,7 +345,7 @@ pre {
|
|
|
345
345
|
<div class="project-name visible-md visible-lg">k6-cucumber-steps</div>
|
|
346
346
|
<div class="label-container">
|
|
347
347
|
<div class="generated-on">
|
|
348
|
-
|
|
348
|
+
Sun Apr 27 2025 15:16:51 GMT+0100 (West Africa Standard Time)
|
|
349
349
|
</div>
|
|
350
350
|
</div>
|
|
351
351
|
</div>
|
|
@@ -397,50 +397,6 @@ pre {
|
|
|
397
397
|
</div>
|
|
398
398
|
|
|
399
399
|
|
|
400
|
-
<div class="panel panel-default">
|
|
401
|
-
<div class="panel-heading open">
|
|
402
|
-
<h4 class="panel-title">
|
|
403
|
-
<a data-toggle="collapse" href="#logOutput">
|
|
404
|
-
<i class="glyphicon glyphicon-chevron-right"></i>
|
|
405
|
-
<i class="glyphicon glyphicon-chevron-down"></i>
|
|
406
|
-
<b>Metadata</b>
|
|
407
|
-
</a>
|
|
408
|
-
</h4>
|
|
409
|
-
</div>
|
|
410
|
-
<div id="logOutput" class="panel-collapse collapse in">
|
|
411
|
-
<div class="panel-body">
|
|
412
|
-
<div class="row">
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
<div class="clearfix metadata col-xs-12 col-sm-6 col-md-6 col-lg-6">
|
|
418
|
-
<div class=pull-left>
|
|
419
|
-
<strong> browser: </strong>[object Object]
|
|
420
|
-
</div>
|
|
421
|
-
</div>
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
<div class="clearfix metadata col-xs-12 col-sm-6 col-md-6 col-lg-6">
|
|
426
|
-
<div class=pull-right-lg>
|
|
427
|
-
<strong> device: </strong>Local test machine
|
|
428
|
-
</div>
|
|
429
|
-
</div>
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
<div class="clearfix metadata col-xs-12 col-sm-6 col-md-6 col-lg-6">
|
|
434
|
-
<div class=pull-left>
|
|
435
|
-
<strong> platform: </strong>[object Object]
|
|
436
|
-
</div>
|
|
437
|
-
</div>
|
|
438
|
-
|
|
439
|
-
</div>
|
|
440
|
-
</div>
|
|
441
|
-
</div>
|
|
442
|
-
</div>
|
|
443
|
-
|
|
444
400
|
|
|
445
401
|
|
|
446
402
|
|
|
@@ -458,7 +414,7 @@ pre {
|
|
|
458
414
|
<div class="tags">
|
|
459
415
|
</div>
|
|
460
416
|
|
|
461
|
-
<a data-toggle="collapse" href="#
|
|
417
|
+
<a data-toggle="collapse" href="#collapseFeaturek6_cucumber_steps8d55ad41-25d0-413a-933f-4c4468a9a5af">
|
|
462
418
|
<i class="glyphicon glyphicon-chevron-right"></i>
|
|
463
419
|
<i class="glyphicon glyphicon-chevron-down"></i>
|
|
464
420
|
<b>Feature:</b>Run load tests with dynamic GET and POST body from environment variables and JSON files
|
|
@@ -474,7 +430,7 @@ pre {
|
|
|
474
430
|
</a>
|
|
475
431
|
</h4>
|
|
476
432
|
</div>
|
|
477
|
-
<div id="
|
|
433
|
+
<div id="collapseFeaturek6_cucumber_steps8d55ad41-25d0-413a-933f-4c4468a9a5af" class="panel-collapse collapse">
|
|
478
434
|
<div class="panel-body">
|
|
479
435
|
|
|
480
436
|
|
|
@@ -488,7 +444,7 @@ pre {
|
|
|
488
444
|
|
|
489
445
|
</div>
|
|
490
446
|
|
|
491
|
-
<a data-toggle="collapse" href="#
|
|
447
|
+
<a data-toggle="collapse" href="#collapseScenariok6_cucumber_steps69d25417-c242-4a12-aa39-f0109365cd2d">
|
|
492
448
|
<div>
|
|
493
449
|
|
|
494
450
|
<div style="padding-right: 30px">
|
|
@@ -513,7 +469,7 @@ pre {
|
|
|
513
469
|
</a>
|
|
514
470
|
</h4>
|
|
515
471
|
</div>
|
|
516
|
-
<div id="
|
|
472
|
+
<div id="collapseScenariok6_cucumber_steps69d25417-c242-4a12-aa39-f0109365cd2d"
|
|
517
473
|
class="panel-collapse collapse">
|
|
518
474
|
<div class="panel-body">
|
|
519
475
|
<div></div>
|
|
@@ -677,8 +633,8 @@ pre {
|
|
|
677
633
|
|
|
678
634
|
|
|
679
635
|
|
|
680
|
-
<pre class=info><br>/api/
|
|
681
|
-
https://
|
|
636
|
+
<pre class=info><br>/api/users?page=2
|
|
637
|
+
https://simple-books-api.glitch.me/books</pre>
|
|
682
638
|
|
|
683
639
|
|
|
684
640
|
|
|
@@ -753,7 +709,7 @@ https://reqres.in/api/users?page=2</pre>
|
|
|
753
709
|
|
|
754
710
|
|
|
755
711
|
<span class="step-duration">
|
|
756
|
-
|
|
712
|
+
5s 869ms
|
|
757
713
|
</span>
|
|
758
714
|
|
|
759
715
|
|
|
@@ -790,7 +746,7 @@ https://reqres.in/api/users?page=2</pre>
|
|
|
790
746
|
|
|
791
747
|
</div>
|
|
792
748
|
|
|
793
|
-
<a data-toggle="collapse" href="#
|
|
749
|
+
<a data-toggle="collapse" href="#collapseScenariok6_cucumber_stepsc0477b14-0f60-4570-997e-e11d79c91de0">
|
|
794
750
|
<div>
|
|
795
751
|
|
|
796
752
|
<div style="padding-right: 30px">
|
|
@@ -815,7 +771,7 @@ https://reqres.in/api/users?page=2</pre>
|
|
|
815
771
|
</a>
|
|
816
772
|
</h4>
|
|
817
773
|
</div>
|
|
818
|
-
<div id="
|
|
774
|
+
<div id="collapseScenariok6_cucumber_stepsc0477b14-0f60-4570-997e-e11d79c91de0"
|
|
819
775
|
class="panel-collapse collapse">
|
|
820
776
|
<div class="panel-body">
|
|
821
777
|
<div></div>
|
|
@@ -979,8 +935,8 @@ https://reqres.in/api/users?page=2</pre>
|
|
|
979
935
|
|
|
980
936
|
|
|
981
937
|
|
|
982
|
-
<pre class=info><br>/api/
|
|
983
|
-
https://
|
|
938
|
+
<pre class=info><br>/api/users?page=2
|
|
939
|
+
https://simple-books-api.glitch.me/books</pre>
|
|
984
940
|
|
|
985
941
|
|
|
986
942
|
|
|
@@ -1055,7 +1011,7 @@ https://reqres.in/api/users?page=2</pre>
|
|
|
1055
1011
|
|
|
1056
1012
|
|
|
1057
1013
|
<span class="step-duration">
|
|
1058
|
-
11s
|
|
1014
|
+
11s 204ms
|
|
1059
1015
|
</span>
|
|
1060
1016
|
|
|
1061
1017
|
|
|
@@ -100,37 +100,6 @@ When("the authentication type is {string}", function (authType) {
|
|
|
100
100
|
this.config.headers = generateHeaders(authType, process.env);
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
// Then(
|
|
104
|
-
// "the API should handle the {word} request successfully",
|
|
105
|
-
// { timeout: 60000 }, // Increase timeout to 60 seconds
|
|
106
|
-
// async function (method) {
|
|
107
|
-
// // Normalize both values to uppercase for comparison
|
|
108
|
-
// const expectedMethod = method.toUpperCase();
|
|
109
|
-
// const actualMethod = this.config.method.toUpperCase();
|
|
110
|
-
|
|
111
|
-
// if (actualMethod !== expectedMethod) {
|
|
112
|
-
// throw new Error(
|
|
113
|
-
// `Mismatched HTTP method: expected "${expectedMethod}", got "${actualMethod}"`
|
|
114
|
-
// );
|
|
115
|
-
// }
|
|
116
|
-
|
|
117
|
-
// try {
|
|
118
|
-
// // Generate the k6 script content
|
|
119
|
-
// const scriptContent = buildK6Script(this.config);
|
|
120
|
-
|
|
121
|
-
// // Generate the temporary k6 script file
|
|
122
|
-
// const scriptPath = generateK6Script(scriptContent);
|
|
123
|
-
|
|
124
|
-
// // Run the k6 script and capture the output
|
|
125
|
-
// const stdout = await runK6Script(scriptPath);
|
|
126
|
-
// } catch (error) {
|
|
127
|
-
// console.error("k6 execution failed:", error.message);
|
|
128
|
-
// console.error("k6 stderr:", error.stderr); // Log stderr for debugging
|
|
129
|
-
// throw new Error("k6 test execution failed");
|
|
130
|
-
// }
|
|
131
|
-
// }
|
|
132
|
-
// );
|
|
133
|
-
|
|
134
103
|
Then(
|
|
135
104
|
"the API should handle the {word} request successfully",
|
|
136
105
|
{ timeout: 60000 },
|
|
@@ -147,12 +116,11 @@ Then(
|
|
|
147
116
|
}
|
|
148
117
|
try {
|
|
149
118
|
const scriptContent = buildK6Script(this.config);
|
|
150
|
-
const scriptPath = generateK6Script(scriptContent);
|
|
119
|
+
const scriptPath = await generateK6Script(scriptContent);
|
|
151
120
|
const stdout = await runK6Script(scriptPath);
|
|
152
121
|
} catch (error) {
|
|
153
122
|
console.error("k6 execution failed:", error.message);
|
|
154
123
|
throw new Error("k6 test execution failed");
|
|
155
124
|
}
|
|
156
|
-
console.log("Final configuration before k6 execution:", this.config);
|
|
157
125
|
}
|
|
158
126
|
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import http from 'k6/http';
|
|
3
|
+
import { check } from 'k6';
|
|
4
|
+
|
|
5
|
+
export const options = {
|
|
6
|
+
"vus": 10,
|
|
7
|
+
"duration": "5s",
|
|
8
|
+
"thresholds": {
|
|
9
|
+
"http_req_failed": [
|
|
10
|
+
"rate<0.05"
|
|
11
|
+
],
|
|
12
|
+
"http_req_duration": [
|
|
13
|
+
"p(95)<3000"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default function () {
|
|
19
|
+
|
|
20
|
+
const resolvedUrl0 = "https://postman-echo.com/get?foo1=bar1&foo2=bar2";
|
|
21
|
+
const res0 = http.request("GET", resolvedUrl0, null, {
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
console.log(`Response Body for ${resolvedUrl0}: ${res0.body}`);
|
|
27
|
+
check(res0, {
|
|
28
|
+
"status is 2xx": (r) => r.status >= 200 && r.status < 300
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const resolvedUrl1 = "https://postman-echo.com/get?foo1=bar1&foo2=bar2";
|
|
33
|
+
const res1 = http.request("GET", resolvedUrl1, null, {
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
console.log(`Response Body for ${resolvedUrl1}: ${res1.body}`);
|
|
39
|
+
check(res1, {
|
|
40
|
+
"status is 2xx": (r) => r.status >= 200 && r.status < 300
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import http from 'k6/http';
|
|
3
|
+
import { check } from 'k6';
|
|
4
|
+
|
|
5
|
+
export const options = {
|
|
6
|
+
"vus": 50,
|
|
7
|
+
"duration": "10s",
|
|
8
|
+
"thresholds": {
|
|
9
|
+
"http_req_failed": [
|
|
10
|
+
"rate<0.05"
|
|
11
|
+
],
|
|
12
|
+
"http_req_duration": [
|
|
13
|
+
"p(95)<3000"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default function () {
|
|
19
|
+
|
|
20
|
+
const resolvedUrl0 = "https://postman-echo.com/get?foo1=bar1&foo2=bar2";
|
|
21
|
+
const res0 = http.request("GET", resolvedUrl0, null, {
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
console.log(`Response Body for ${resolvedUrl0}: ${res0.body}`);
|
|
27
|
+
check(res0, {
|
|
28
|
+
"status is 2xx": (r) => r.status >= 200 && r.status < 300
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const resolvedUrl1 = "https://postman-echo.com/get?foo1=bar1&foo2=bar2";
|
|
33
|
+
const res1 = http.request("GET", resolvedUrl1, null, {
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
console.log(`Response Body for ${resolvedUrl1}: ${res1.body}`);
|
|
39
|
+
check(res1, {
|
|
40
|
+
"status is 2xx": (r) => r.status >= 200 && r.status < 300
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|