Ebeid ElSayed
Ebeid ElSayed

Reputation: 1156

How to generate jmeter client using Swagger code-gen?

I'm trying to generate a jmeter client using swagger-codegen-cli-3.0.3.jar as follows:

java -jar swagger-codegen-cli-3.0.3.jar generate -i swagger.json -l jmeter

but it is giving me the following exception:

Exception in thread "main" java.lang.RuntimeException: Can't load config class with name jmeter Available: aspnetcore
csharp
csharp-dotnet2
dynamic-html
html
html2
java
jaxrs-cxf-client
jaxrs-cxf
inflector
jaxrs-cxf-cdi
jaxrs-spec
jaxrs-jersey
jaxrs-di
jaxrs-resteasy-eap
jaxrs-resteasy
spring
openapi
openapi-yaml
kotlin-client
kotlin-server
php
scala
scala-akka-http-server
swift3
swift4
typescript-angular

Am I missing something ?

Upvotes: 2

Views: 3023

Answers (2)

Asanka V
Asanka V

Reputation: 664

I was able to generate Jmeter client with below command with the latest openapi-generator-cli-4.1.2.jar

java -jar openapi-generator-cli-4.1.2.jar generate -i swagger.json -g jmeter

enter image description here Please note I tried with swagger: "2.0" file

Upvotes: 1

Dmitri T
Dmitri T

Reputation: 168072

You can use Taurus free and open source automation framework in order to convert your Swagger JSON definition into Taurus YAML file which in its turn can be converted into a JMeter .jmx script.

  1. Install Taurus
  2. Execute swagger2yaml command like:

    swagger2yaml your_swagger_definition.json -o yourtest.yml
    

    it will generate yourtest.yml file in Taurus YAML format. At this stage you can alreay execute it using Taurus

  3. If you want to convert the Taurus YAML script into JMeter .jmx script execute the following command:

    bzt yourtest.yml -gui 
    

    it will open generated test in JMeter GUI, you will be able to save it to the desired location under the desired name normally from JMeter File menu

Check out Navigating your First Steps Using Taurus article for more information on how to use Taurus tool.

Upvotes: 1

Related Questions