问题
I have created one scenario in Jmeter where i am loging in. (For this scenario i am using REST APIs) For this i took one "HTTP Header Manager" , "HTTP Request Sampler".
After login i am extracting authentication token which is generated automatically. Using this auth token i am trying to add some values in application. For this i used: 1) jp@gc - JSON Path Extractor 2) Debug Sampler
On execution, i can see auth token capture in "View Results Tree" listner.
But adding user (second HTTP Request sampler) steps fails saying error "unauthorized.
Can you please tell me how to use that auth token in "Add User" step so that i can update web application.
回答1:
The JSON extractor values have to be filled like mentioned in the sample (image) above.
Pass the variable as ${jsonVal} to second HTTP Request sampler as value to parameter for authentication token either in the HTTP request or the HTTP Header data (wherever applicable).
Hope this will help.
来源:https://stackoverflow.com/questions/27603167/how-to-use-variable-extracted-in-json-path-extractor-for-further-steps-of-scenar