jmeter 无法提取响应中数据键内的变量值

hgc7kmma  于 2023-01-13  发布在  其他
关注(0)|答案(1)|浏览(211)

当我在下面的请求中将userName作为数据键内的变量传递时,无法获取值。我在登录请求响应中获得了userName。此处的UserName和playerName相同。
登录请求:
42 ["获取登录",{"密钥":"AUEEW891WL","套接字ID":"${sid}","用户名":""、"头像":""、"语言":"en"、"播放器移动":""、"加入游戏":""、"重播":0,"游戏ID":0,"游戏号":0,"数据":"&电子邮件= llk ${counter5}@gmail.com &密码= poker","玩家":0,"级别":"","上次操作":""、"游戏":""、"游戏币":1,"角色":""}]

    • 答复:**

42 ["获得登录",{"响应":{"玩家ID ":25601,"总成功率":0,"积分":0,"玩家名称":"673508846384","显示名称":"llk45","玩家排名":"业余爱好者"、"playerBank":"11K","玩家银行金额":11000,"玩家化身":"头像1.jpg","玩家邮箱":"www.example.com"、"玩家级别":llk45@gmail.com"等级1"、"玩家等级编程":0,"玩家等级点数":100,"黄金玩家":0,"玩家经销商ID":1、"玩家FbId":""、"加载词汇":"","每日奖金":0,"令牌":"0a5260592b6efc02d3102c639eac0f60d91ad7de8bf57f114da179f05bcfa84","IP地址":"www.example.com"、"界面":{"主页":[{"按钮标题":"赌场"、"按钮图标":182.74.4.226{"类型":"功能","名称":"加载大厅"}},{"按钮标题":"联赛"、"按钮图标":"联盟图标"、"按钮操作":{"类型":"功能","名称":"加载大厅"}},{"按钮标题":"俱乐部"、"按钮图标":"俱乐部图标"、"按钮操作":{"类型":"功能","名称":"加载大厅"}},{"按钮标题":"收银台","按钮图标":"收银员图标"、"按钮操作":{"类型":"面板","名称":"pnlChipStore "}},{"按钮标题":"设置"、"按钮图标":"设置图标"、"按钮操作":{"类型":"面板","名称":"pnl设置"}},{"按钮标题":"通知"、"按钮图标":"通知图标"、"按钮操作":{"类型":"面板","名称":"pnlLevel "}}]},"玩家国家":"IN"、"角色":1}}] { "type": "panel", "name": "pnlLevel" } } ] }, "playerCountry": "IN", "role": 1 } } ]

    • 请求:**

42 ["创建_游戏",{"键":"AUEEW891WL","套接字ID":"${sid}","用户名":${用户名} ","头像":"头像17.jpg","语言":"en"、"播放器移动":""、"加入游戏":""、"重播":0,"游戏ID":0,"游戏号":0,"数据":"&游戏ID =未定义&游戏=德克萨斯&游戏币= 1 &游戏样式=私人现金游戏&桌面名称= llk桌面${counter1} & rakeRate = 0 &速度= 60& sb = 10& bb = 20&桌面低= 100 &桌面限制= 1000 &视频要求=假&用户名= ${userName}","玩家":0,"级别":347,"最后一个动作":""、"游戏":""、"游戏币":1,"角色":"1","令牌":"${令牌}","玩家ID":"${玩家ID} "}]

    • 响应请求:**

42 ["创建_游戏",{"键":"AUEEW891WL","套接字ID":"TRV8Rm_jtsqn_BBFAAiM","用户名":"673508846384","头像":"头像17.jpg","语言":"en"、"播放器移动":""、"加入游戏":""、"重播":0,"游戏ID":0,"游戏号":0,"数据":"&游戏ID =未定义&游戏=德克萨斯&游戏币= 1 &游戏样式=私人现金游戏&桌面名称= llk桌面47 &抽成率= 0 &速度= 60&桌面宽度= 100 &桌面限制= 1000 &视频要求=假&用户名=" 673508846384 ","玩家":0,"级别":347,"最后一个动作":""、"游戏":""、"游戏币":1,"角色":"1","令牌":"0a5260592b6efc02d3102c639eac0f60d91ad7de8bf57f114da179f05bcfa84","玩家ID":"25601 "}]
下面是截图:enter image description here
我如何在data键内的create game请求中传递这个值以获取它?

brc7rcf0

brc7rcf01#

如果您的${userName}变量有值(即,它是通过用户定义变量设置的,或来自后处理器,或来自CSV数据集配置)- JMeter将在请求中发送值。
如果变量没有值- JMeter将发送${userName}
因此,请仔细检查${userName}变量:
1.存在
1.有其各自的价值
这可以使用Debug Sampler and View Results Tree listener combination来完成。

相关问题