Is your feature request related to a problem? Please describe.
The K6 generator, generates an almost ready to use K6 script.
Example
group("/portal/v1/domainclusters/{domainClusterId}", () => {
let domainClusterId = "TODO_EDIT_THE_DOMAINCLUSTERID";
let url = BASE_URL + `/portal/v1/domainclusters/${domainClusterId}`;
// Request No. 1
let request = http.get(url);
check(request, {
"Success": (r) => r.status === 200
});
sleep(SLEEP_DURATION);
// Request No. 2
// TODO: edit the parameters of the request body.
body = {"name": "string", "servers": "list"};
params = {headers: {"Content-Type": "application/json"}};
request = http.put(url, body, params);
check(request, {
"Success": (r) => r.status === 204
});
sleep(SLEEP_DURATION);
In the above there are 2 parts of the generated script, that require some manual modifications.
Query parameter:
let domainClusterId = "TODO_EDIT_THE_DOMAINCLUSTERID";
Request Body
body = {"name": "string", "servers": "list"};
The goal is to use the generated script in an Continuous integration flow.
The flow would be:
- Manage OpenApi spec
- Push to OA to GIT
- Trigger build pipeline
-- generated documentation
-- generate postman collection
-- generate a K6 script via the openapi-generator
-- trigger a load test via K6
Describe the solution you'd like
In the OpenApi you can define "example" values
'/portal/v1/domainclusters/{domainClusterId}':
get:
operationId: get-domain-clusters-id
tags:
- DomainClusters
summary: Get a specific domain cluster configuration
parameters:
- domainClusterId:
name: domainClusterId
description: ID of the domain cluster setting.
in: path
required: true
schema:
type: string
nullable: true
example: f0c01c3a-6880-46c3-abb3-7a45828d1c45
responses:
'200':
description: Success
put:
operationId: put-domain-clusters-id
tags:
- DomainClusters
summary: Update a domain cluster configuration
parameters:
- domainClusterId:
name: domainClusterId
description: ID of the domain cluster setting.
in: path
required: true
schema:
type: string
nullable: true
example: f0c01c3a-6880-46c3-abb3-7a45828d1c45
requestBody:
description: The updated values
content:
application/json:
schema:
required:
- name
type: object
properties:
name:
description: The name of the domain cluster.
type: string
example: CLUSTER-1
servers:
description: The list of servers.
type: array
items:
type: string
example:
- s1
- s2
responses:
'204':
description: Success
A handy solution would be to use the examples, like os
Query parameter:
let domainClusterId = "TODO_EDIT_THE_DOMAINCLUSTERID";
Take the example values from OpenApi
params > servers > schema > example: f0c01c3a-6880-46c3-abb3-7a45828d1c45
which would result in:
let domainClusterId = "f0c01c3a-6880-46c3-abb3-7a45828d1c45";
Request Body
body = {"name": "string", "servers": "list"};
Take the example values from OpenApi
requestBody > content > properties > name > example: CLUSTER-1
requestBody > content > properties > servers > example: - S1 - S2
Describe alternatives you've considered
creating a PR, but I'm not sure how to get started with the excellent K6 generator from @mostafa , due to no experience in JAVA development and if the mentioned example data is available in the OpenApi class.
Is your feature request related to a problem? Please describe.
The K6 generator, generates an almost ready to use K6 script.
Example
In the above there are 2 parts of the generated script, that require some manual modifications.
Query parameter:
let domainClusterId = "TODO_EDIT_THE_DOMAINCLUSTERID";Request Body
body = {"name": "string", "servers": "list"};The goal is to use the generated script in an Continuous integration flow.
The flow would be:
-- generated documentation
-- generate postman collection
-- generate a K6 script via the openapi-generator
-- trigger a load test via K6
Describe the solution you'd like
In the OpenApi you can define "example" values
A handy solution would be to use the examples, like os
Query parameter:
let domainClusterId = "TODO_EDIT_THE_DOMAINCLUSTERID";Take the example values from OpenApi
params > servers > schema > example: f0c01c3a-6880-46c3-abb3-7a45828d1c45
which would result in:
let domainClusterId = "f0c01c3a-6880-46c3-abb3-7a45828d1c45";Request Body
body = {"name": "string", "servers": "list"};Take the example values from OpenApi
requestBody > content > properties > name > example: CLUSTER-1
requestBody > content > properties > servers > example: - S1 - S2
Describe alternatives you've considered
creating a PR, but I'm not sure how to get started with the excellent K6 generator from @mostafa , due to no experience in JAVA development and if the mentioned example data is available in the OpenApi class.