Swagger-codegen: Gatling and Scala generation

Created on 4 Nov 2016  路  10Comments  路  Source: swagger-api/swagger-codegen

Swagger-codegen

I want to use the generated scala classes in a Gatling test scenario. But no gatling report is generated because no execution chain is invoked in the generated InvokeApi. I am using eclipse.

Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:48)
at io.gatling.app.LogFileProcessor.generateReports(RunResultProcessor.scala:64)
at io.gatling.app.LogFileProcessor.processRunResult(RunResultProcessor.scala:43)
at io.gatling.app.Gatling.start(Gatling.scala:66)
at io.gatling.app.Gatling$.start(Gatling.scala:57)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:49)
at io.gatling.app.Gatling$.main(Gatling.scala:43)
at io.gatling.app.Gatling.main(Gatling.scala)

Swagger-codegen version

2.2.1

Swagger declaration file content or url
Command line used for generation

Scala
Scala-editor - manually convert the swagger.json
Java 8
STS
Maven

Steps to reproduce
  1. Get a REST server swagger json
  2. Use it to generate scala client code.
  3. Try to create a Gatling scenario with the generated scala classes.
  4. Start the gatling test.
Related issues
Suggest a Fix

Introduce a Gatling scala code generation option and add it in Swagger-editor

Scala Feature help wanted

Most helpful comment

Hi guys,

We started using swagger & gatling, so naturally we wanted to generate some of the code. I'm sharing what we came up with. It's working for us, YMMV.

https://github.com/qsorix/swagger-codegen/commit/78ed5a5d87e5afba0b1e15d4290aed4711dac2e1

Feel free to take it and contribute more. I'm not creating a PR, as I don't really have time right now to polish the code or even go through contributors checklist.

All 10 comments

@YordanBorisov would you have time to contribute the enhancement "Gatling" as an option to the Scala API client?

@wing328 Currently I do not have time - the fastest solution is to re-write the ApiInvoker to use Gatling instead of jersey

@wing328 When do you think the Milestone 2.2.2 will be published?

https://github.com/swagger-api/swagger-codegen/wiki/FAQ#how-long-does-it-take-to-release-a-stable-version-eg-215--216

So the next year will be ready?

Hi guys,

We started using swagger & gatling, so naturally we wanted to generate some of the code. I'm sharing what we came up with. It's working for us, YMMV.

https://github.com/qsorix/swagger-codegen/commit/78ed5a5d87e5afba0b1e15d4290aed4711dac2e1

Feel free to take it and contribute more. I'm not creating a PR, as I don't really have time right now to polish the code or even go through contributors checklist.

This is great job @qsorix ! We really need to integrate that in the code base ! Gatling is really awesome for performance testing so I think this would benefit to all swagger users.

Actually Scala API client in 2.3.0 is being rewritten by @clasnake

We'll see how we can incorporate those enhancements into the new Scala API client in 2.3.0 instead.

Hi, I have tried out the scala-gatling client generation for my swagger 2.0 json. I felt that the client that was generated was different from the initial proposal that was made here. Couple of concerns that I had with the generated code.

  • Instead of a re-usable client, a single simulation was generated covering all the APIs.
  • The generated code was for gatling 2.x

The commit mentioned https://github.com/qsorix/swagger-codegen/commit/78ed5a5d87e5afba0b1e15d4290aed4711dac2e1 seems to be more inline to what I was looking for.

Is there any active work going on for Gatling 3.x support. I was tweaking the above commit to make it work for 3.x. So, was thinking if we could add something like scala-gatling3 kind of support in the supported languages to make it work more efficiently?

Please share your thoughts.

Was this page helpful?
0 / 5 - 0 ratings