I am generating Jmeter's jmx file from a swagger definition, the JMX and test data CSV that gets generated seems pretty useless, it has no parameter information as to what the API expected, no http status code to response mapping information etc.
You can take any definition file, to reproduce this:
What I expected was a JMX with the entire skeleton of the API so that the QA people don't have to worry about that and focus only on tests.
All the clients that I produce for other languages/tools are good enough to go except Jmeter, am I doing anything wrong here?
I generated JMeter (JMX) for different APIs and I got it to work, though a few issues and caveats.
First it generates
Caveats and Issues
The loop count is controlled by variable, testCases. However there is a bug in swagger-code-gen template for JMeter if you want to pass this in via the command line
GET Parameters are fill with 0 instead of ${variable_name}, this is from the template in swagger codegen. I have a fix in my fork that I have tested. The other option is just to fix it in the JMX file Original And after editing Parameters
Example Swagger that works
The following is the Swagger file I used (modified from echo) and the generated (with modification for Parameters) JMX. I have tested this JMX using RedLine13 Example Test and passing the parameters as required. Passing in parameters
-JtestCases=50
-Jhost=mazimi-prod.apigee.net
-Jport=80
And here is the example Yaml
---
swagger: '2.0'
info:
version: 1.0.0
title: Echo
description: |
#### Echos back every URL, method, parameter and header
Feel free to make a path or an operation and use **Try Operation** to test it. The echo server will
render back everything.
schemes:
- http
host: mazimi-prod.apigee.net
basePath: /echo
paths:
/{id}:
get:
parameters:
- name: id
in: path
description: ID
type: string
required: true
- name: user
in: query
description: name
type: string
required: true
- name: location
in: query
description: location
type: string
required: true
responses:
200:
description: Echo GET
Updated JMEter template in Swagger CodeGen
Since there are a few issues for making this work seamless within SwaggerCode Gen i created an issue and pull request. If you need to use it sooner the fork is over here https://github.com/richardfriedman/swagger-codegen/commit/5aff601eaccf67ec44bb681816d40a25e5aa20a3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With