接口测试基础----postman、jmeter

一,什么是接口

接口一般接口分两种:

系统对外接口:与外部系统对接的接口,用来获取或者传递数据给外部系统

系统内部接口:系统模块、方法之间用来获取或者传递数据的接口

二、接口分类

webservice接口:走soap协议,通过HTTP传输,现在用的较少,测试工具:soapUI

HTTP api接口:走HTTP协议,请求方法一般为get和post两种,返回参数一般为json串

三、get请求和post请求区别:

1、get使用URL或cookie传参,post将数据放在body中(实质区别)

2、get的URL有长度限制,而post请求的数据可以非常大

3、post比get安全,因为在地址栏上不可见

4、一般get用来获取数据,而post用来发送数据

四、使用postman测试HTTP接口:

1、get请求将参数放到URL中接口测试基础----postman、jmeter

2、post请求将参数放到body中

接口测试基础----postman、jmeter

 

 3、post请求参数较多,使用json串传参

接口测试基础----postman、jmeter

4、需要设置cookie和header的,在header中设置

接口测试基础----postman、jmeter

接口测试基础----postman、jmeter

 

 5、上传文件需要将类型改为file

接口测试基础----postman、jmeter

五、使用jmeter测试HTTP接口

1、get请求

接口测试基础----postman、jmeter

2、post请求和get一样

接口测试基础----postman、jmeter

3、参数较多,使用json传参

接口测试基础----postman、jmeter

4、cookie设置

接口测试基础----postman、jmeter

5、设置header信息

接口测试基础----postman、jmeter

6、上传文件

接口测试基础----postman、jmeter

7、设置参数

接口测试基础----postman、jmeter

8、定义变量

接口测试基础----postman、jmeter

9、设置断言

接口测试基础----postman、jmeter

10、寻找参数

接口测试基础----postman、jmeter

接口测试基础----postman、jmeter

11、设置数据库

接口测试基础----postman、jmeter

 

接口测试基础----postman、jmeter

 接口测试基础----postman、jmeter