🎉一个持续迭代的开源接口测试平台

🎉一个持续迭代的开源接口测试平台

Property
Jun 27, 2022 03:32 AM
Status
Date
notion image

notion image
notion image
notion image
notion image

技术栈

notion image
  • FastApi(前期Flask,所以教程初期也是Flask)
    • notion image
  • SQLAlchemy(你可以看到很多sqlalchemy的用法)
    • notion image
  • Apscheduler(定时任务框架)
  • mitmproxy(mock,用例录制生成)
    • notion image
  • Redis
    • notion image
  • Gunicorn(内含uvicorn,部署服务)
    • notion image
  • Nginx(反向代理,https配置等)
    • notion image
  • 七牛云oss(用于文件上传时接口测试文件存储)
    • notion image
  • asyncio(几乎全异步写法,值得参考)
    • notion image
  • Grpc(支持Grpc请求,即将支持)
    • notion image

前端地址

notion image
notion image

说明

notion image
这是一个具备完整开发手册(开发手册,手把手教那种),严格按照写一块内容补一篇文章的形式创作而成,其中也经历了从FlaskFastApi 的快速过渡。也许代码质量没有特别高,但是对于新人来说,跟着一步一步,不但可以完成从接口自动化框架接口自动化平台的转变,还能从中看到作者不断优化的过程。
如果你也想从0到1开始打造一个测试平台,那pity将是你不二的选择。话不多说,赶快开始体验吧!靓仔靓女们~
Details
notion image
Details

即将到来

notion image
Details

使用文档

notion image

开发参考文章

notion image

关于Pity平台

notion image
pity是一款专注于api自动化的工具,采用Python+FastApi+React开发,目前还不能作为生产级别的工具,作者正在努力之中。
这个项目叫pity,一个从0开始写的自动化测试平台(基于FastApi),旨在总结自己最近几年的工作经验,也顺便帮助大家进步。目前还在火热更新中,基本上每周都会更新几篇吧,前期以教学+编码为主,后期以实现功能为主。希望大家能够喜欢!~
项目起源是本人很期待的某家公司
notion image
拒绝了我,觉得特别遗憾吧
notion image
。加上这一年浑浑噩噩的,也没有什么产出,做的东西不如18,19年多。所以打算把自己18-19的项目重写出来,给大家一些参考。

Docker部署

  1. 安装Docker Desktop
  1. 打开终端并进入pity目录
  1. 执行以下命令,安静等待pity启动即可(不需要额外安装mysql redis等,一键启动直接起飞)
docker镜像由卫衣哥(QYZHG倾情制作
notion image
docker-compose -f .\ops\docker-compose.yaml up

二次开发

  1. 拉取代码
$ git clone https://github.com/wuranxu/pity
$ cd pity
  1. 安装依赖
# 可换豆瓣源或者清华源安装依赖
$ pip install -r requirements.txt
    1. 安装并启动redis
    1. 安装并启动mysql
    1. 修改conf/dev.env
修改其中mysql和redis连接信息,redis虽然可以不开启,但是会导致定时任务重复执行(基于redis实现了分布式锁)。
  1. 启动服务
$ python pity.py
  1. 注册用户
打开浏览器输入: http://localhost:7777进入登录页。
点击注册按钮,第一个注册的用户会成为超级管理员,拥有一切权限。
notion image
登录后就可以开启pity之旅啦!

作者介绍

notion image
大家好,我是米洛,一个乐于分享,喜欢钻研技术的测试开发工程师,目前就职于上海某互联网公司。

一个打游戏不拿首胜不睡觉的韭0后。

个人技术公众号: `米洛的测开日记`,欢迎大家关注我,掌握最新测试开发知识。
notion image

平台初心

notion image
虽说各大公司都有自己的接口测试平台,并且做的肯定比我的强。但是还是有很多公司,并没有这样的条件去投入人力专职开发接口测试平台。
博主我在18年的时候接触到了Yapi这款接口文档管理工具,那是去哪儿团队开发的,但现在已经连官网都找不到了,仅仅只留下一个github.io的地址,让人叹息。
扯远了,我看到他们大前端团队开源了如此一款精美的工具,内心也是激动万分。
人活一辈子,并不长久,总得做些有意义的事情。虽然开源这件事情基本上没有什么收益可言,但总得有人做,世界才会更美好是不?
所以我打算制作这样一款工具,面向的就是中小型公司,他们没有那么多时间/人力成本,甚至是测试资源较为匮乏,那么如果你来到了这儿,我想这款工具可以给你们带来帮助!如果是有一定的经验的Python测试开发,这款工具也可以给你带来一定的借鉴作用。

落地效果

notion image
可能有人会怀疑项目是否能真正运用到生产系统里,这款工具其实是我在某大型共享单车公司实践2年多的一款工具。之前是golang开发,如今我离开那家公司,打算保留原本功能的基础之上进一步优化,并新增更多丰富的特性。所以大家可以放心,它绝对是一款能方便解决你api自动化测试的利器。

已有功能

  • 完善的用户登录/注册机制,提供第三方(github)登录
    • notion image
  • 完善的项目管理机制
    • notion image
  • 结合FastApi,利用asyncio让Python代码也可以起飞
    • notion image
  • 完整的接口测试流程
  • 强大的数据构造器, 解决接口数据依赖问题
    • notion image
  • 在线调试http请求,堪比网页版本postman
  • 完善的全局变量机制,拒绝case中的死数据
    • notion image
  • 速度还挺快的
    • notion image
  • 在线redis请求
    • notion image
  • 测试计划/集合
    • notion image
  • 在线数据库ide,数据库管理功能
    • notion image
  • 漂亮的邮件通知
    • notion image
  • 定时构建测试用例
    • notion image
  • 精美的测试报告展示页面

待开发的功能

notion image
  • app管理功能,支持app的导入和导出
    • notion image
  • 代码覆盖率增量/全量统计功能
    • notion image
  • 微服务化
    • notion image
  • 数据工厂,强大的造数功能
    • notion image
  • 用例支持har,jmx等格式导入
    • notion image
  • CI/CD,类pipeline功能
    • notion image
  • 推送功能,支持钉钉/企信推送
    • notion image
  • 支持dubbo/grpc
    • notion image
  • 打通yapi
    • notion image
  • 等等等等
    • notion image

赞助

如果您觉得这个项目对你有所帮助,可以请我吃根辣条哦~或者帮忙点个star,让我创作更有动力!!!谢谢大家啦!
notion image
notion image

微信交流群

二维码会经常过期,可以加我个人微信: wuranxu,我拉你到群聊。
notion image