如何将在JSON路径提取器中提取的变量用于场景的进一步步骤? [英] How to use variable extracted in JSON path extractor for further steps of scenario?

查看:612
本文介绍了如何将在JSON路径提取器中提取的变量用于场景的进一步步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在登录的Jmeter中创建了一个方案.(对于此方案,我正在使用REST API) 为此,我选择了一个"HTTP标头管理器","HTTP请求采样器".

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".

登录后,我正在提取自动生成的身份验证令牌. 使用此身份验证令牌,我试图在应用程序中添加一些值. 为此,我使用了: 1)jp @ gc-JSON路径提取器 2)调试采样器

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

执行后,我可以在查看结果树"列表器中看到auth令牌捕获.

On execution, i can see auth token capture in "View Results Tree" listner.

但是添加用户(第二个HTTP请求采样器)步骤失败,提示错误未授权."

But adding user (second HTTP Request sampler) steps fails saying error "unauthorized.

能否请您告诉我如何在添加用户"步骤中使用该身份验证令牌,以便我可以更新Web应用程序.

Can you please tell me how to use that auth token in "Add User" step so that i can update web application.

推荐答案

必须像上面的示例(图像)中所提到的那样填充JSON提取器值.

The JSON extractor values have to be filled like mentioned in the sample (image) above.

将变量作为 $ {jsonVal} 作为 second HTTP Request sampler 的值传递给 authentication令牌(适用时).

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).

希望这会有所帮助.

这篇关于如何将在JSON路径提取器中提取的变量用于场景的进一步步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆