1、创建setup线程,获取token的接口在所有线程中优先执行,确保后续线程可以拿到token

2、添加配置原件-Http信息头管理器,添加取样器-http请求
配置好接口路径,端口,前端传参数据,调试一下,保证获取token的接口可以跑通

3、使用json提取器/正则表达式提取器提取接口返回的token

4、 添加BeanShell后置处理程序,将token设置为全局变量
使用函数助手,sstproperty,填写json提取的参数名,设置为全局变量的参数名

点击生成,复制生成的字符串,填写在BeanShell后置处理程序中

5、验证
新建另一个线程组,新建填写一个查询接口,创建http信息头管理器、http请求
使用函数助手P函数,生成获取token的字符串,填写在http信息头管理器中

也可以用property函数

跑接口验证返回值
