当前位置:网站首页>[Learning Records of Boxue Valley] Super summary, share with heart | Software Testing Interface Testing Basics
[Learning Records of Boxue Valley] Super summary, share with heart | Software Testing Interface Testing Basics
2022-08-02 03:34:00 【Nauica】
接口测试基础
1. 接口测试理论
- 接口:
- 分裂
- 硬件接口
- 软件接口(主体)
- 概念:数据交互的通道
- 分裂
- 接口类型:
- 系统之间的接口
- 系统内部的接口
- 接口测试:
- 针对接口进行测试,Is primarily to test the data transfer、交互、Control management process as well as the interface between reliance on
- 原理:
- Simulate the client connection is established
- 发送请求
- 服务端处理请求并响应
- 校验响应数据
- 特点:
- 测试可以提前介入,修改bug成本低,符合质量前移的理念
- Can be found in the page doesn't spot the problem
- 低成本、高收益
- 接口测试不同于单元测试,Is standing in the user's perspective on the overall business test
- 实现方式:
- 通过工具实现:
- Postman
- Jmeter
- 通过代码实现:
- Python + Requests
- 通过工具实现:
- 接口自动化测试概念:
- 针对接口进行测试,Use tools or code instead of people to test
2. HTML 协议
- 介绍:超文本传输协议,A kind of widely used on the Internet way
- 特点:
http://www.itcast.cn:8080/news/index.html?uid=123&page=1
- Based on the client and server mode
- 简单快捷
- 灵活
- 无状态
- 无连接
- url 格式解析
- 说明:统一资源定位符
- 格式:协议、域名、端口号、资源路径、参数
- 示例:
- 协议:HTTP、HTTPS、FTP等
- 域名:可以是域名也可以是IP地址
- 端口号:默认的端口号可以省略
- http:80
- https:443
- 资源路径:
- 图片、视频、音频、链接、接口等
- 参数:
- ?:隔离uil主体与参数部分内容
- & :存在多个参数时,使用&进行链接
- HTTP请求
- 组成:请求行、请求头、请求体
- 请求行:
- 位置:第一行信息
- 内容:
- 请求方式
- 资源路径
- 协议与版本
- 请求头:
- 位置:第一行之后,空行之前的内容
- 内容:
- 主要以键值对形式存在
- Content-Type = application/json
- 请求体:
- 前提:get没有请求体,一般请求体在post与put方式中使用
- 位置:空行之后
- 内容形式:json、html、text等
- 请求方式:
- get:查询数据
- post:新增数据
- put:修改数据
- delete:删除数据
- 请求行:
- 组成:请求行、请求头、请求体
- HTTP响应
- 组成:状态行、响应头、响应体
- 状态行:
- 位置:第一行信息
- 内容:
- 状态码:
- 2xx:请求成功
- 3xx:重定向
- 4xx:客户端存在问题
- 5xx:The service side there is a problem
- 状态码:
- 响应头:
- 位置:第一行之后,空行之前
- 内容:键值对形式存在,Used to describe the server information
- 响应体:
- 位置:空行之后
- 响应数据:xml、json、html 等
- 状态行:
- 组成:状态行、响应头、响应体
3. 接口规范
1. 传统接口风格
不同的公司、不同的项目、Different development between the interfaces of the difference is very big
Request way generally use only get 和 post
The response status code USES only200表示处理成功
2. RESTful结构风格(规范)
- 规范风格:是规范,Is not a standard or rules
- 示例:
- URL :
协议://域名:端口号/资源路径/{资源集合}/{指定资源}
- 请求方法:get post put delete
- 状态码:200 201 204
- URL :
- Request method with a status code corresponding( 重点 )
- 查询操作:请求方法【get】响应状态码【200】
- 新增操作:请求方法【post】响应状态码【201】
- 修改操作:请求方法【put】响应状态码【201】
- 删除操作:请求方法【delete】响应状态码【204】
4. 测试流程
- 需求分析
- API文档(接口文档)解析
- 设计测试用例
- 执行测试用例
- 使用工具
- 使用代码
- 缺陷跟踪与管理
- 生成测试报告
- Sustainable inheritance
5. API 文档
定义:
- API 文档:Is a description interface information(请求:请求方式、请求地址、请求参数;响应:状态码、响应数据)的文档
功能:
- 便于前端开发和后端开发更好的协作
- When project alternation and change,Easy-to-use and maintenance
- 便于测试尽早介入
内容:
- 基本信息:接口名称、请求方式、接口地址(path)、接口描述
- 请求参数:
- 请求头(headers):
- 请求体(body):
- 前提:post与put有请求体
- 内容:参数名称、参数类型、是否必填、示例、备注等
- 响应数据:
- 状态码
- 响应数据:参数名称、参数类型、是否必填、示例、备注等
边栏推荐
- JVM学习----垃圾回收--G1
- parser = argparse.ArgumentParser()解析
- 构造方法、方法重载、全局变量与局部变量
- subprocess.CalledProcessError: Command ‘pip install ‘thop‘‘ returned non-zero exit status 1.
- Cut out web icons through PS 2021
- IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
- Good Key, Bad Key (thinking, temporary exchange, classic method)
- oracle inner join and outer join
- About cross-domain issues
- 磷脂-聚乙二醇-醛基 DSPE-PEG-Aldehyde DSPE-PEG-CHO MW:5000
猜你喜欢
Mysql8创建用户以及赋权操作
mysql中如何查看表是否被锁
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
周日数据库作业
MySQL分库分表
UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the index ing argu
「PHP基础知识」PHP中对象的使用
磷脂-聚乙二醇-巯基,DSPE-PEG-Thiol,DSPE-PEG-SH,MW:5000
【程序人生】做了多年的运维,靠什么转行拿下12K+年终奖的薪资?
MySql创建数据表
随机推荐
磷脂-聚乙二醇-酰肼,DSPE-PEG-Hydrazide,DSPE-PEG-HZ,MW:5000
动态代理工具类
Debian 10 NTP Service Configuration
MySQL分组后取最大一条数据【最优解】
MySQL删除表数据 MySQL清空表命令 3种方法
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
基本运算符
「PHP基础知识」空值(null)的使用
String comparison size in MySQL (date string comparison problem)
周日数据库作业
About cross-domain issues
@Autowired与@Resource区别
[详解C语言]一文带你玩转C语言小游戏---扫雷
AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
错误:with open(txt_path,‘r‘) as f: FileNotFoundError: [Errno 2] No such file or directory:
The difference between the knowledge question and answer session with the knowledge
DOM destruction and reproduction experiment
MySQL常见的索引
手把手带你 Unity 入门之从零创建一个时钟(GameObjects 与 Scripts)
MySql创建数据表