Jmeter:即使在参数化之后也会收到无效的令牌响应
Jmeter: Invalid token response is received even after parameterizing
我是性能测试新手。我有几个线程组,第一个线程组用于登录应用程序并执行搜索。第二个线程组用于加载需要身份验证的特定页面。
问题:在第一个线程组中,我使用了 JSON 提取器并提取了身份验证令牌。我也通过 HTTP Header Manager 将相同的令牌传递给其他线程组。但我收到类似 {"detail":"Invalid token."}
的回复
有更好的方法吗?是否可以为身份验证令牌设置 Env 并在所有线程组中使用它?
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads
因此您不能在线程组之间传递 JMeter 变量,您需要使用 __setProperty() function in 1st Thread Group and access the value using __P() function in 2nd Thread Group. See Knit One Pearl Two: How to Use Variables in Different Thread Groups 文章将其转换为 JMeter 属性 以获得更详细的信息。
一个更优雅的解决方案是使用 Inter-Thread Communication 插件,这样您将确保需要来自第二个线程组的令牌的线程不会启动,除非有可用的有效令牌。
我是性能测试新手。我有几个线程组,第一个线程组用于登录应用程序并执行搜索。第二个线程组用于加载需要身份验证的特定页面。
问题:在第一个线程组中,我使用了 JSON 提取器并提取了身份验证令牌。我也通过 HTTP Header Manager 将相同的令牌传递给其他线程组。但我收到类似 {"detail":"Invalid token."}
的回复有更好的方法吗?是否可以为身份验证令牌设置 Env 并在所有线程组中使用它?
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads
因此您不能在线程组之间传递 JMeter 变量,您需要使用 __setProperty() function in 1st Thread Group and access the value using __P() function in 2nd Thread Group. See Knit One Pearl Two: How to Use Variables in Different Thread Groups 文章将其转换为 JMeter 属性 以获得更详细的信息。
一个更优雅的解决方案是使用 Inter-Thread Communication 插件,这样您将确保需要来自第二个线程组的令牌的线程不会启动,除非有可用的有效令牌。