k6-cucumber-steps 1.0.5 → 1.0.7
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/lib/index.js +5 -0
- package/package.json +1 -1
- package/reports/load-results.html +8 -1
- package/reports/load-results.json +231 -0
- package/step_definitions/load_test_steps.js +4 -4
- package/libs/index.js +0 -21
- /package/{libs → lib}/helpers/buildK6Script.js +0 -0
- /package/{libs → lib}/helpers/generateHeaders.js +0 -0
- /package/{libs → lib}/helpers/resolveBody.js +0 -0
- /package/{libs → lib}/utils/k6Runner.js +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"description": "",
|
|
4
|
+
"elements": [
|
|
5
|
+
{
|
|
6
|
+
"description": "",
|
|
7
|
+
"id": "run-load-tests-with-dynamic-get-and-post-body-from-environment-variables-and-json-files;i-run-the-k6-script-for-load-testing-with-dynamic-get-requests",
|
|
8
|
+
"keyword": "Scenario Outline",
|
|
9
|
+
"line": 47,
|
|
10
|
+
"name": "I run the k6 script for load testing with dynamic GET requests",
|
|
11
|
+
"steps": [
|
|
12
|
+
{
|
|
13
|
+
"arguments": [],
|
|
14
|
+
"keyword": "Given ",
|
|
15
|
+
"line": 33,
|
|
16
|
+
"name": "I have a k6 script for GET testing",
|
|
17
|
+
"match": {
|
|
18
|
+
"location": "step_definitions/load_test_steps.js:21"
|
|
19
|
+
},
|
|
20
|
+
"result": {
|
|
21
|
+
"status": "passed",
|
|
22
|
+
"duration": 525166
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"arguments": [
|
|
27
|
+
{
|
|
28
|
+
"rows": [
|
|
29
|
+
{
|
|
30
|
+
"cells": [
|
|
31
|
+
"virtual_users",
|
|
32
|
+
"duration",
|
|
33
|
+
"http_req_failed",
|
|
34
|
+
"http_req_duration",
|
|
35
|
+
"error_rate"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"cells": [
|
|
40
|
+
"10",
|
|
41
|
+
"5",
|
|
42
|
+
"rate<0.05",
|
|
43
|
+
"p(95)<3000",
|
|
44
|
+
"<error_rate>"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"keyword": "When ",
|
|
51
|
+
"line": 34,
|
|
52
|
+
"name": "I run the k6 script with the following configurations:",
|
|
53
|
+
"match": {
|
|
54
|
+
"location": "step_definitions/load_test_steps.js:25"
|
|
55
|
+
},
|
|
56
|
+
"result": {
|
|
57
|
+
"status": "passed",
|
|
58
|
+
"duration": 228541
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"arguments": [
|
|
63
|
+
{
|
|
64
|
+
"content": "/api/users?page=2\nhttps://simple-books-api.glitch.me/books",
|
|
65
|
+
"line": 38
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"keyword": "And ",
|
|
69
|
+
"line": 37,
|
|
70
|
+
"name": "the following endpoint(s) is/are used:",
|
|
71
|
+
"match": {
|
|
72
|
+
"location": "step_definitions/load_test_steps.js:83"
|
|
73
|
+
},
|
|
74
|
+
"result": {
|
|
75
|
+
"status": "passed",
|
|
76
|
+
"duration": 48999
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"arguments": [],
|
|
81
|
+
"keyword": "When ",
|
|
82
|
+
"line": 42,
|
|
83
|
+
"name": "the authentication type is \"none\"",
|
|
84
|
+
"match": {
|
|
85
|
+
"location": "step_definitions/load_test_steps.js:99"
|
|
86
|
+
},
|
|
87
|
+
"result": {
|
|
88
|
+
"status": "passed",
|
|
89
|
+
"duration": 78249
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"arguments": [],
|
|
94
|
+
"keyword": "Then ",
|
|
95
|
+
"line": 43,
|
|
96
|
+
"name": "the API should handle the GET request successfully",
|
|
97
|
+
"match": {
|
|
98
|
+
"location": "step_definitions/load_test_steps.js:134"
|
|
99
|
+
},
|
|
100
|
+
"result": {
|
|
101
|
+
"status": "passed",
|
|
102
|
+
"duration": 5869350583
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"tags": [
|
|
107
|
+
{
|
|
108
|
+
"name": "@loadTest",
|
|
109
|
+
"line": 31
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"type": "scenario"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"description": "",
|
|
116
|
+
"id": "run-load-tests-with-dynamic-get-and-post-body-from-environment-variables-and-json-files;i-run-the-k6-script-for-load-testing-with-dynamic-get-requests",
|
|
117
|
+
"keyword": "Scenario Outline",
|
|
118
|
+
"line": 48,
|
|
119
|
+
"name": "I run the k6 script for load testing with dynamic GET requests",
|
|
120
|
+
"steps": [
|
|
121
|
+
{
|
|
122
|
+
"arguments": [],
|
|
123
|
+
"keyword": "Given ",
|
|
124
|
+
"line": 33,
|
|
125
|
+
"name": "I have a k6 script for GET testing",
|
|
126
|
+
"match": {
|
|
127
|
+
"location": "step_definitions/load_test_steps.js:21"
|
|
128
|
+
},
|
|
129
|
+
"result": {
|
|
130
|
+
"status": "passed",
|
|
131
|
+
"duration": 70459
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"arguments": [
|
|
136
|
+
{
|
|
137
|
+
"rows": [
|
|
138
|
+
{
|
|
139
|
+
"cells": [
|
|
140
|
+
"virtual_users",
|
|
141
|
+
"duration",
|
|
142
|
+
"http_req_failed",
|
|
143
|
+
"http_req_duration",
|
|
144
|
+
"error_rate"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"cells": [
|
|
149
|
+
"50",
|
|
150
|
+
"10",
|
|
151
|
+
"rate<0.05",
|
|
152
|
+
"p(95)<3000",
|
|
153
|
+
"<error_rate>"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"keyword": "When ",
|
|
160
|
+
"line": 34,
|
|
161
|
+
"name": "I run the k6 script with the following configurations:",
|
|
162
|
+
"match": {
|
|
163
|
+
"location": "step_definitions/load_test_steps.js:25"
|
|
164
|
+
},
|
|
165
|
+
"result": {
|
|
166
|
+
"status": "passed",
|
|
167
|
+
"duration": 51750
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"arguments": [
|
|
172
|
+
{
|
|
173
|
+
"content": "/api/users?page=2\nhttps://simple-books-api.glitch.me/books",
|
|
174
|
+
"line": 38
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"keyword": "And ",
|
|
178
|
+
"line": 37,
|
|
179
|
+
"name": "the following endpoint(s) is/are used:",
|
|
180
|
+
"match": {
|
|
181
|
+
"location": "step_definitions/load_test_steps.js:83"
|
|
182
|
+
},
|
|
183
|
+
"result": {
|
|
184
|
+
"status": "passed",
|
|
185
|
+
"duration": 29375
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"arguments": [],
|
|
190
|
+
"keyword": "When ",
|
|
191
|
+
"line": 42,
|
|
192
|
+
"name": "the authentication type is \"none\"",
|
|
193
|
+
"match": {
|
|
194
|
+
"location": "step_definitions/load_test_steps.js:99"
|
|
195
|
+
},
|
|
196
|
+
"result": {
|
|
197
|
+
"status": "passed",
|
|
198
|
+
"duration": 106124
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"arguments": [],
|
|
203
|
+
"keyword": "Then ",
|
|
204
|
+
"line": 43,
|
|
205
|
+
"name": "the API should handle the GET request successfully",
|
|
206
|
+
"match": {
|
|
207
|
+
"location": "step_definitions/load_test_steps.js:134"
|
|
208
|
+
},
|
|
209
|
+
"result": {
|
|
210
|
+
"status": "passed",
|
|
211
|
+
"duration": 11204749374
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"tags": [
|
|
216
|
+
{
|
|
217
|
+
"name": "@loadTest",
|
|
218
|
+
"line": 31
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"type": "scenario"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"id": "run-load-tests-with-dynamic-get-and-post-body-from-environment-variables-and-json-files",
|
|
225
|
+
"line": 1,
|
|
226
|
+
"keyword": "Feature",
|
|
227
|
+
"name": "Run load tests with dynamic GET and POST body from environment variables and JSON files",
|
|
228
|
+
"tags": [],
|
|
229
|
+
"uri": "src/examples/features/loadTestTemplate.feature"
|
|
230
|
+
}
|
|
231
|
+
]
|
|
@@ -4,10 +4,10 @@ const { Given, When, Then } = require("@cucumber/cucumber");
|
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const { execSync } = require("child_process");
|
|
7
|
-
const resolveBody = require("../
|
|
8
|
-
const buildK6Script = require("../
|
|
9
|
-
const generateHeaders = require("../
|
|
10
|
-
const { generateK6Script, runK6Script } = require("../
|
|
7
|
+
const resolveBody = require("../lib/helpers/resolveBody.js");
|
|
8
|
+
const buildK6Script = require("../lib/helpers/buildK6Script.js");
|
|
9
|
+
const generateHeaders = require("../lib/helpers/generateHeaders.js");
|
|
10
|
+
const { generateK6Script, runK6Script } = require("../lib/utils/k6Runner.js");
|
|
11
11
|
require("dotenv").config();
|
|
12
12
|
|
|
13
13
|
// Validate thresholds (e.g., "rate<0.01")
|
package/libs/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// lib/index.js (example with JavaScript)
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Registers the k6-cucumber-steps step definitions with the Cucumber runner.
|
|
6
|
-
* @param projectRootDir The absolute path to the root directory of the user's project.
|
|
7
|
-
*/
|
|
8
|
-
function registerSteps(projectRootDir) {
|
|
9
|
-
// Construct the path to your package's step definitions
|
|
10
|
-
const packageStepsPath = path.resolve(__dirname, "../step_definitions");
|
|
11
|
-
|
|
12
|
-
return [packageStepsPath];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
registerSteps,
|
|
17
|
-
buildK6Script: require("./helpers/buildK6Script"),
|
|
18
|
-
generateHeaders: require("./helpers/generateHeaders"),
|
|
19
|
-
resolveBody: require("./helpers/resolveBody"),
|
|
20
|
-
k6Runner: require("./utils/k6Runner"),
|
|
21
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|