当前位置:网站首页>[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有请求体
- 内容:参数名称、参数类型、是否必填、示例、备注等
- 响应数据:
- 状态码
- 响应数据:参数名称、参数类型、是否必填、示例、备注等
边栏推荐
- The difference between the knowledge question and answer session with the knowledge
- @Autowired详解[email protected]在static属性上的使用
- 周日数据库作业
- 手把手带你 Unity 入门之从零创建一个时钟(GameObjects 与 Scripts)
- TRICK second bullet
- 知识问答与知识会话的区别
- Problems when yolov5 calls ip camera
- subprocess.CalledProcessError: Command ‘pip install ‘thop‘‘ returned non-zero exit status 1.
- DAY-1 | 求两个正整数的最大公约数与最小公倍数之和——辗转相除法
- Mysql8.0安装教程
猜你喜欢
LeetCode:746. 使用最小花费爬楼梯【动态规划】
小程序组件总结
第十一天&shell脚本
活体检测 Adaptive Normalized Representation Learning for GeneralizableFace Anti-Spoofing 阅读笔记
subprocess.CalledProcessError: Command 'pip install 'thop'' returned non-zero exit status 1.
磷脂-聚乙二醇-酰肼,DSPE-PEG-Hydrazide,DSPE-PEG-HZ,MW:5000
AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
亚马逊卖家怎么提升转化率
MySql创建数据表
知识工程作业2:知识工程相关领域介绍
随机推荐
【C语言万字长文】 宏定义 结构体 共用体 内存对齐知识点总结
分布式领域最重要的一篇论文,到底讲了什么?
网站与服务器维护怎么做?
JJWT工具类
APK的安装过程分析 PMS包管理器
5.nodejs--cross domain, CORS, JSONP, Proxy
线性代数学习笔记2-1:向量和向量组、线性相关性(张成空间的概念)
MySQL分组后取最大一条数据【最优解】
磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
DSPE-PEG-Silane, DSPE-PEG-SIL, phospholipid-polyethylene glycol-silane modified active group
腾讯50题
亚马逊卖家怎么提升转化率
小程序组件总结
5. Hezhou Air32F103_LCD_key
MySQL8.0与MySQL5.7差异分析
SOCKS5
MySql创建数据表
Knowledge Engineering Assignment 2: Introduction to Knowledge Engineering Related Fields
Problems when yolov5 calls ip camera
getattr() function analysis