Interface testing and interface testing tool
1. What is the interface?
接口,Application Programming Interface(API)
Popular talk is HTTP requests
2, what is the interface testing ?
Test assembly for testing an interface between the test interface.
Mainly used between the detection system and the external system, each subsystem within the system point of interaction.
Many front and rear ends are separated individually from the front only to verify, is not enough, the front end is too easy to bypass, also you need to be validated from the interface level.
3, interface testing strategy?
Interface testing also belong to
functional testing
, functional testing is to test the business logic, interface documentation in accordance with written
test cases
, test execution, to see the different parameters of the request, the server can not return the expected results.
4, interface testing tool?
jmeter、postman
5, interface test type?
get、post
get is to get data from the server
post to the server is mass participation
6. Analysis examples of how to do interface testing
1) Registration Interface
http://ip/api/user/user_reg
Request method post
Returning to the example:
{
"error_code": 0,
"Msg": "Registration Success"
}
Fill in the following figure postman in the address input interface, change the interface mode of the input parameters for the post body and meet the parameters required interface document - click the send button
Add Student Information:
Type parameter post json
Is required
No non-mandatory
These parameter fields written json format:
{
"name":"狗狗",
"grade":"某某座",
"phone":12345654321,
"sex":"男",
"age":28,
"addr":"某某路"
|
单击send按钮
给学生充值-需要用到登录cookie的接口
在headers中添加登录的cookie,如果是不同的用户的cookie,可以对用户的cookie进行关联,在充值接口中调用该关联的参数
这个用jmeter来操作,必填项为stu_id gold 都是int类型
登录的服务器返回结果为:
{
"error_code": 0,
"login_info": {
"login_time": "20180815163827",
"sign": "d5eb0557e5e8c880ec8b04469bbf0a54",
"userId": 9234
}
|
可以在登录 添加 正则表达式来提取cookie;也可以添加一个Extractor 来提取
Add http header information added cookie manager ---- --- If a plurality of users may be extracted cookie above by way of FIG. 2, the user needs to different users parameterized graph wawawa the need to do a parameterization, and the need to retain login operation;
A single user, then, http header Manager - simply write wawawa = cookie value on it
How do interface, the interface is very simple and very simple