Generating load test script from Swagger/OpenAPI specification

Hi, has anyone tried this documentation Load Testing Your API with Swagger/OpenAPI and k6?

I have gone through all these links without success:

My installed versions are:

java version “13.0.1” 2019-10-15
Java™ SE Runtime Environment (build 13.0.1+9)
Java HotSpot™ 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)

I have installed npm package wrapper for OpenAPI Generator too:

$ openapi-generator version

Anyone able to help me with

  1. more detailed steps of how to setup everything to use this generator?
  2. how to properly use the command which I think it is openapi-generator

Thank you

Hi @nifepo,

I have written this guide and the extension and I am quite sure it works.

Since I didn’t want to bother users with the task of installing JRE as part of this guide, I have used Docker, which already has all the needed components, for the converter to work. If you want to run the converter using JRE, have a look at this section of its original README docs: 1.3 - Download JAR.

The npm package wrapper is also not needed if you use either the Docker image or the JAR file, and I have no idea why you installed that.

Just let me know here, if you want to know more or if I can help you with specifics.

P.S. I think you’ve copied the links from Slack, thus they don’t redirect correctly.

Hi @mostafa

I apologize if my opening question didn’t sound well and offended you, It wasn’t my intention.
I have choosed to try to get used to docker.

Everything is installed, docker version works and Hello World too, I created an account as well (docker).

I ran **docker pull openapitools/openapi-generator-cli** and it ended correctly. I was expecting to see some sort of dashboard with pulled projects or images or , but couldn’t see it listed. This is surely becasue of myself being new to docker I assume.

Despite of that, I ran:
$ docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate
-g k6
-o /local/k6-test/

Got an access denied error to my local drive and I solved it with

Tried to ran same command again and now the error is:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.

It seems to be related to my docker configuration, i’m working on a solution.

Thanks for your feedback and help.

Hey again! :slight_smile:

Since you’re having issues mounting volumes (folders on your local machine) to Docker, which is a known issue on Docker, I suggest you to use the JAR file instead, which I’ve mentioned above.

Hi, I was able to solve it.

  1. update command to be run on one single line only:

docker run --rm -v \c\tests:/local openapitools/openapi-generator-cli generate -i -g k6 -o /local/k6-test/ --skip-validate-spec

  1. We stop using C:/Users/xxxx drive to avoid all kind of different permission issues and used a new folder at C level instead. (didn’t create a new drive yet)
    So we changed ${PWD}:/local to \c\tests:/local <---- “tests” is our new folder.
  2. We unchecked Read Only from this created folder and save changes.

Command was ran successfully, folder and files were created as well.

Thank you for your help and patience, have a great day !

1 Like

Hi @nifepo,

I am really glad to see your case solved.

Good luck exploring! :slight_smile: