How to use variable extracted in JSON path extractor for further steps of scenario?

不羁岁月 提交于 2020-01-15 07:28:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!