Jmeter is not handling huge JSON payload - json

I'm trying to execute the Jmeter script POST call with some 55 thousands of line JSON payload, with this request I see the error as 500 in the Jmeter tool and also seen JSON parser error in the log-entries.
I think Jmeter is not handing with these huge request payload and not parse the correct JSON data to server.
NOTE: With the same payload I am able to execute the API via POSTMAN.
Please suggest how to handle huge payload in the Jmeter.
Thanks,

It might be a copy-paste issue, I would recommend using __FileToString() function directly in the HTTP Request sampler body like:
${__FileToString(/path/to/your/file.json,,)}
A better idea would be going for HTTP Raw Request sampler which has nice feature of streaming the file directly to the server without loading it in memory first

Related

How to send a GET request with JSON body in JMeter?

I am facing some issues as JMeter doesn't take the JSON body passed as a parameter. I tried through postman and it was working fine but for Jmeter it is not working
I am expecting a response from get request with JSON body in Jmeter
We're not telepathic enough in order to suggest you how you can fix your "some issues" without knowing the details of the "issues"
JMeter can send the GET request with the JSON (or any other) body
If the request works in Postman and doesn't in JMeter most probably you're not sending the same requests, the most common mistake is that people forget to add a HTTP Header Manager configured to send correct Content-Type header.
Just use a 3rd-party sniffer tool to intercept requests originating from JMeter or Postman, identify the difference(s) and amend your JMeter configuration so the requests would be exactly the same. Alternatively just record the request from Postman using JMeter's HTTP(S) Test Script Recorder

Jmeter - when there are number of threads are running, the variable from JSON extractor is not working sometimes

I am now using Jmeter to run the test of APIs.
The situation is that I have a login Api which will return a token inside response. I use a JSON extractor to save the token as a variable. Then, I use the ${token} is the header of other requests.
However, I found that when I was trying to run 40-50 threads, the ${token} in some threads would be empty, and caused a high error rate.
Therefore, may I ask is there any method to solve it and why?
Thanks very much.
Try saving full response from the Login API, most probably your server gets overloaded and cannot return the token and returning some error message instead.
There are following options:
If you're running JMeter in command-line non-GUI mode you can amend JMeter's Results File Configuration to store the results in XML form and include the response data, add the next lines to user.properties file:
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true
and when you run your test next time the .jtl results file will contain response bodies for all the requests.
Another option is using a Listener like Simple Data Writer configured like:
and when you run the test the responses.xml file will contain the response data
Both .jtl results file and responses.xml can be inspected using View Results Tree listener
More information: How to Save Response Data in JMeter

How to disable response parsing in Karate?

I'm using Karate 0.9.5. and am testing an endpoint that returns a 125MB json response (I know, shouldn't do that over json -- but am stuck for now). How can I disable Karate from parsing the response json and just treat it as plain text? The response takes milliseconds to come over the wire, but Karate just hangs trying to parse the response. I don't need to validate the response, just check for 200 OK.
Thanks.
You can't. I suggest you write a Java util (should be just 5-10 lines of code) to do a GET or whatever to this end-point and call it from Karate and save to something like target/temp.json or discard the response.
Refer to Java interop: https://github.com/intuit/karate#calling-java
If you use karate-apache then the Apache HTTP Client will be in the classpath. So you can refer to the docs: https://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/fundamentals.html#d5e49
Also look at the end of this test for an alternative example of making a GET / POST in Java: ProxyServerTest.java

Sim808 + Arduino UNO: Get Json Object Response from Web Server

How to read JSON object response from the server?
These are the commands I use:
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","internet"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+HTTPINIT
AT+HTTPSSL=1
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","https://www.mywebsite.com/getTime?token=jsdaljdaskl"
AT+HTTPPARA="REDIR",1
AT+HTTPACTION=0
The returning request should be Json object, but the Sim808 read it as html response which gives error 606.
Need to define HTTP parameter content as JSON format using the following command
AT+HTTPPARA="CONTENT","application/json"
Found this document useful HTTP Client using SIM900.

Jmeter - Fetch the Session ID from the Response and pass it next request.Request & Responses are in JSON

Scenario :-
Im performing Load testing using API's
HTTP Request 1
I logged in using http://cabhound.com:1000/v2/driver/login and I got the below response
{"statusCode":200,"statusMessage":"Success","errorMessage":"","responseData":{"id":0,"userName":"PQeurentraps5S#tarento.com","firstName":"Partner","lastName":"Tarento","phoneNumber":"2641148625","email":"tamvrentrapnsr#tarento.com","password":"","addressOne":"","addressTwo":"","city":"","state":"","zipCode":"","loginCount":156,"welcome":"","smsOptIn":false,"promoCode":"","userNotification":"","errorMessage":"","message":"","sessionId":"6063tnerLt3013951671120oDse18492930#2","osType":"","osVersion":"","deviceType":"","deviceId":"","latitude":"","longitude":"","timeZone":"","appVersion":"","company":"Tarento","licenceNumber":"","vehicleType":"","vehicleFeature":null,"subscriptionType":"unlimited","driverWorkingCity":"Bangalore","vehicleNumber":"","locationUpdateTime":20,"rate":0,"reliable":0,"distance":0.0,"eta":0,"latitudeLongitude":"","status":"ON","payment":{"paymentType":"","cardNumber":"","cvnNumber":"","expDate":""},"vehicleTypeList":["Sedan","Limousine","SUV/Wagon","Minivan","Other"],"vehicleFeatureList":["Navigation System","Eco Friendly","Handicap accessible","Accepts credit cards"],"driverId":582,"currentLocation":null,"companyCode":"tarento","acceptanceRate":0,"like":0,"profileIndicator":0,"payWithCabHound":false,"smsSupport":false,"paymentInfo":false,"geoInfo":"","active":true}}
Please see the session id in the above response,which I want to use in next http request data
HTTP Request 2
http://cabhound.com:1000/v2/driver/dutyStatus
Below is the data which I need to post,here I want to use session id of HTTP Request 1
{"status":"ON","sessionId":"1311tnerLt9013956793297oDse462783#2","longitude":"77.686700","userName":"erpkrentrapJps#tarento.com","latitude":"12.934487"}
How to pass the session id of HTTP Request 1 (response) to HTTP Request 2 Post Data
Help me in this which I have strucked
I would recommend using JSON Path Extractor available through JMeter Plugin (you'll need Extras with Libs Set.
Regex are headache to develop, especially for JSON data which can be multiline. Beanshell has known performance issues, so using a plugin is the best option.
Relevant JSON Path query for your sessionId will look as:
$.responseData.sessionId
See Parsing JSON section of Using the XPath Extractor in JMeter guide for more details and XPath to JSON Path mapping
I can see 2 solutions for above problem,
Use Regular expression extractor to extract the value (I haven't used it with json response but I think it will work)
Use Beanshell preprocessor or postprocessor in which you can get response and find required sessionID using substr or json parsers or use simple java code. Extract the required value and use it in next request.