Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 1.41 KB

File metadata and controls

13 lines (7 loc) · 1.41 KB

Generated k6 script

The script.js file contains most of the Swagger/OpenAPI specification and you can customize it to your needs.

Global header variables are defined at the top of the file, like api_key. Each path in the specification is converted into a group in k6 and each group contains all the request methods related to that path. Path and query parameters are extracted from the specification and put at the start of the group. The URL is constructed from the base URL plus path and query.

k6 specific parameters are in the params object, and body contains the request body which is in the form of identifier: type, which the type should be substituted by a proper value. Then goes the request and the check.

Check are like asserts but differ in that they don't halt execution, instead they just store the result of the check, pass or fail, and let the script execution continue.

Each request is always followed by a 0.1 second sleep to prevent the script execution from flooding the system with too many requests simultaneously.

Note that the default iteration count and VU count is 1. So each request in each group will be executed once. For more information, see the k6 options.