Regarding performance Testing of Two Apis in JMeter

44 views
Skip to first unread message

SUMIT KUMAR KAMTI

unread,
Jun 20, 2024, 6:01:42 AMJun 20
to JMeter Forum

Hi All,

I hope you are doing well. I have some concerns related to performance testing.

Requirement:

I want to create a Test Plan in JMeter. I have two APIs, so first I want to hit the first API, and based on the response from the first API, I want to pass some of its response data to the second API call. In both API calls, I need to upload a file.

Implementation:

I have created a test plan in JMeter where I added a thread group. Then, for the first API HTTP Request, I added all the required parameters in the parameter section and provided the file path in the file upload section. I set the parameter name to "file" and the file type to "application/pdf". Next, I added a JSON Extractor to extract the necessary variables from the first API response to use in the second API call.

For the second HTTP request, I followed the same steps as for the first API HTTP request. However, in the parameter section, I passed the variable extracted in the JSON Extractor from the first API response.

Response:

From the first API, I am getting the following response:

{
    "data": [],
    "type": "Error",
    "message": "Cannot read properties of undefined (reading 'path')",
    "statusCode": 500
}
 From the second API, I am getting the following response:
  {
    "data": [],
    "type": "Error",
    "message": "Cannot read properties of undefined (reading 'name')",
    "statusCode": 500
}

Please help me solve this issue.

Thanks in advance.

DT

unread,
Jun 20, 2024, 6:39:55 AMJun 20
to JMeter Forum
We cannot help you without seeing your API contract and knowing how exactly you configured the HTTP Request sampler.

Most probably you're sending malformed request. If you can execute it successfully using your browser or other application you can just record the request with HTTP(S) Test Script Recorder, just make sure to copy the file you're uploading to "bin" folder of your JMeter installation beforehand. See JMeter Performance Testing: JMeter Download & Upload Scenarios article for more details.

SUMIT KUMAR KAMTI

unread,
Jun 20, 2024, 6:57:21 AMJun 20
to JMeter Forum
I have tested in postman sended seperate Api call got the response take some parameter which need to call another Api and call another Api got the succesful 
response in both in postman. when i try to did the same in JMeter encounting that issue which i mention earlier. you can see in the image How I implemented in jmeter. 
Screenshot 2024-06-20 162451.png

DT

unread,
Jun 20, 2024, 7:00:04 AMJun 20
to JMeter Forum
If you can send a request successfully using Postman just record it with JMeter, see How to Convert Your Postman API Tests to JMeter for Scaling for detailed instructions

SUMIT KUMAR KAMTI

unread,
Jun 21, 2024, 1:45:26 AMJun 21
to JMeter Forum
Hi Hope you are doing well.
I try the same I just select the template Recording in jmeter and created the test plan after that
in postmake i enable the certificate and in postman selected the custom proxy configuration.
then start the recording in jmeter and then send first request by given specific name in recording then hit
the second Api by given the specific name. but problem is when i enable custom proxy configuration as a localhost and port is 8888
and i am getting the response like this  Parse Error: The server returned a malformed response in postman. when i disable that proxy from postman
i am getting expected response in postman.......I am using dev server for testing.
Thanks in Advance

PrimeQA Solutions

unread,
Jun 21, 2024, 3:11:55 AMJun 21
to ptgr...@googlegroups.com
Hi Sumit,

I think you have not added the header in the jmeter. Please add that. 

If it is working in postman, and if you have added the exact parameters in Jmeter, it should work. Cross check if any parameter is missing to be added in jmeter.

--
You received this message because you are subscribed to the Google Groups "JMeter Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptgram24+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ptgram24/1a191277-6b0e-4f92-baf6-96adc63ee34bn%40googlegroups.com.


--

SUMIT KUMAR KAMTI

unread,
Jun 21, 2024, 3:35:14 AMJun 21
to JMeter Forum
thank you All for your Reply its Really great help. boyond recording i find different way to do that and i got the
Expected Response.

Reply all
Reply to author
Forward
0 new messages