1.新建线程组
添加->Threads(Users)->线程组
线程组用来模拟用户进程。
2.添加http信息头管理器
添加->配置元件->http信息头管理器
Systemid:
Authcode:
以上两个参数是开发定义接口的时候生成的,直接和开发要。
3. 添加http请求默认值
添加->配置元件->http请求默认值
http请求默认值默认这个线程组下的所有用例都用这个服务器ip,也可以在各个用例中单独设置
配置调用的接口地址和端口号,设置了默认值,则下面每个用例下不用单独设置
4.添加用例
添加->Sampler->http请求
配置名称:一般为用例名称
方法:get或者post请求
路径:接口文档中提供
post请求参数的添加方法:
1. 添加parameters
新增一个parameter,名称为data,值为json格式的字符串
2. Body Data
直接将参数写入到body data中。
5. 添加察看结果树
添加->监听器->察看结果树
6.执行用例
定位到用例,点击running
7.查看结果树
在结果树-》响应数据中查看接口返回的参数。