Usage of export functions #53
Replies: 1 comment
-
The goal for postman-to-k6 is to convert a Postman collection into executable K6 scripts, to reduce K6 script maintenance and coding. The outcome is a generated script that is ready to run. The "group" concept is a mapping from Postman folders to K6 groups. K6 groups offer the option to organize K6 script around common logic. An alternative way to manage the "requests" in groups: If you use the --seperate parameters, you 'll get all requests as single functions, so you could build a fixed number of K6 scripts where you would group the requests. Example:
In your k6 scripts, you could manually group them. K6-script-group1.js export default function() {
group("folder1", function() {
postman[Request]("Get Request-1");
});
} K6-script-group2.js export default function() {
group("folder1", function() {
postman[Request]("Get Request-2");
});
group("folder2", function() {
postman[Request]("Get Request-5");
});
} For each of the K6 scripts, you can apply different thresholds. It seems you want to make the execution more dynamic and have control over which requests to run against threshold, during execution. Switching thresholds within one K6 execution is not a common practice, hence the typical strategy to split the execution in multiple execution. This will give you clear metrics on the K6 requests in that 1 execution and if the whole K6 script complies to the defined thresholds. k6 run K6-script-group1.js > success If you would do this dynamically in 1 execution, your results would be very unclear. |
Beta Was this translation helpful? Give feedback.
-
@thim81
Idea behind: I would like to test each
group
in test using scenarios. When I give agroup
in a scenario, that single need to be executed. Is this possible?Another approach:
Is it possible in postman-to-k6 , generating with functions.
eg:
Now if requests in collections is in folder , it is generated using
group
.Generate code in export function
Then in
scenarios
useexec
and give this function name will execute those requests in that function only.Beta Was this translation helpful? Give feedback.
All reactions