My goal is to create a Google Drive CRUD with JMeter. I was able to upload files with proper OAuth configuration.
However, I am struggling in extracting the response data to be used in further HTTP Requests.
The response of the upload is this simple JSON:
{
"kind": "drive#file",
"id": "blablabla",
"name": "Untitled",
"mimeType": "text/plain"
}
I would need to fetch this id in a PostProcessor component and update a JMeter variable with this value. This way I could reference to this value in the Read, Update and Delete requests.
I've tried to use the JSON Extractor and BeanShell, but I was unsucessful.
1 Answer 1
If you want to extract this id
value into a JMeter Variable the relevant Json Path query would be as simple as:
$.id
You can verify this yourself using JSON Path Tester
mode of the View Results Tree listener
So if you add a JSON Extractor as a child of the request which returns the above JSON and configure it like:
JMeter will store it into id
variable as it evidenced by the Debug Sampler:
Going forward you should be able to access this value as ${id}
where required:
More information: API Testing With JMeter and the JSON Extractor