[BUG][JMeter] can't throw json data from csv
Created by: kannkyo
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
JMeter can't support json data from csv.
When I throw bellow csv data,
Example csv data
testCase,httpStatusCode,body
Success,200,"{'id':0,'username':'string','firstName':'string','lastName':'string','email':'string','password':'string','phone':'string','userStatus':0}"
I get "Invalid JSON Error" because of single quotation in json.
Request body
POST http://localhost:4010/user
POST data:
{'id':0,'username':'string','firstName':'string','lastName':'string','email':'string','password':'string','phone':'string','userStatus':0}
[no cookies]
Response body
{"error":{"code":"invalid_json","message":"Invalid JSON"}}
On the other hand, I can't use double quotation in csv.
openapi-generator version
5.0.0
OpenAPI declaration file content or url
Generation Details
When I execute bellow command to generate jemeter files,
git clone https://github.com/OpenAPITools/openapi-generator
mvn install -Dmaven.test.skip=true
./bin/generate-samples.sh bin/configs/other/jmeter.yaml
I want to replace single quotation to double quotation by using jmeter default function "__javaScript".
actual output
...
<stringProp name="Argument.value">${body}</stringProp>
...
expected output
...
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
...
Steps to reproduce
see "Generation Details"
Related issues/PRs
nothing
Suggest a fix
Replace stringProp parameter