{"id":13526760,"url":"https://github.com/wuranxu/pity","last_synced_at":"2025-04-12T20:45:46.484Z","repository":{"id":37448169,"uuid":"345109405","full_name":"wuranxu/pity","owner":"wuranxu","description":"🎉一个持续迭代的开源接口测试平台，欢迎大家多提issue多给反馈。 求star⭐，我会努力更新下去的！","archived":false,"fork":false,"pushed_at":"2024-05-29T10:15:52.000Z","size":177402,"stargazers_count":642,"open_issues_count":25,"forks_count":160,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-10-29T17:23:56.849Z","etag":null,"topics":["aiohttp","apitest","autotest","ddt","fastapi","http","httprunner","mysql","postgresql","python3","react","testplatform","yapi"],"latest_commit_sha":null,"homepage":"http://121.5.2.74","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wuranxu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-06T14:09:42.000Z","updated_at":"2024-10-25T06:25:25.000Z","dependencies_parsed_at":"2023-02-15T09:46:26.815Z","dependency_job_id":"40b01ab5-9922-4efc-9350-f9e1d404166f","html_url":"https://github.com/wuranxu/pity","commit_stats":{"total_commits":410,"total_committers":8,"mean_commits":51.25,"dds":"0.30731707317073176","last_synced_commit":"d5ae82eab54c4e00b7c1cc309dc5a8e4c9124c2e"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuranxu%2Fpity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuranxu%2Fpity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuranxu%2Fpity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuranxu%2Fpity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wuranxu","download_url":"https://codeload.github.com/wuranxu/pity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631692,"owners_count":21136559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohttp","apitest","autotest","ddt","fastapi","http","httprunner","mysql","postgresql","python3","react","testplatform","yapi"],"created_at":"2024-08-01T06:01:34.358Z","updated_at":"2025-04-12T20:45:46.452Z","avatar_url":"https://github.com/wuranxu.png","language":"Python","funding_links":[],"categories":["Python","运维管理平台"],"sub_categories":[],"readme":"[English](https://github.com/wuranxu/pity/blob/main/README_EN.md)\r\n\r\n![png](https://img.shields.io/badge/Python-3.8+-green)\r\n![png](https://img.shields.io/badge/React-17+-blue)\r\n![png](https://img.shields.io/badge/FastApi-green)\r\n![png](https://img.shields.io/badge/contributors-3-green)\r\n\r\n\u003e ~~pity正在微服务化中，近期功能迭代暂缓。~~\r\n\u003e \r\n\u003e 由于微服务个人来做能力实在有限，不走弯路了，继续开发功能...\r\n\r\n### 🎉 技术栈\r\n\r\n- [x] 🎨 FastApi(前期Flask，所以教程初期也是Flask)\r\n- [x] 🎶 SQLAlchemy(你可以看到很多sqlalchemy的用法) \r\n- [x] 🎉 Apscheduler(定时任务框架) \r\n- [x] 🎃 mitmproxy(mock，用例录制生成) \r\n- [x] 🔒 Redis\r\n- [x] 🏐 Gunicorn(内含uvicorn，部署服务)\r\n- [x] 🎲 Nginx(反向代理，https配置等)\r\n- [x] 💎 七牛云oss(用于文件上传时接口测试文件存储)\r\n- [x] 👟 asyncio(几乎全异步写法，值得参考)\r\n- [ ] ⛏ Grpc(支持Grpc请求，即将支持) \r\n\r\n### ⚽ 前端地址\r\n\r\n  [🎁 快点我](https://github.com/wuranxu/pityWeb)\r\n\r\n![](https://static.pity.fun/picture/20220807220041.png)\r\n\r\n\r\n## ☕ 说明\r\n\r\n这是一个具备完整`开发手册`(开发手册，手把手教那种)，严格按照`写一块内容`，`补一篇文章`的形式创作而成，其中也经历了从`Flask`到`FastApi`\r\n的快速过渡。也许代码质量没有很高，但是对于新人来说，跟着一步一步，不但可以完成从`接口自动化框架`到`接口自动化平台`的转变，还能从中看到作者不断优化的过程。\r\n\r\n如果你也想从0到1开始打造一个测试平台，那`pity`将是你不二的选择。话不多说，赶快开始体验吧！靓仔靓女们~\r\n\r\n\u003cdetails open=\"open\"\u003e\r\n\u003csummary\u003e火热开发中\u003c/summary\u003e\r\n\r\n| 功能点      | 敬请期待             |\r\n|:---------|:-----------------|\r\n| 数据工厂     | 🍔🍔🍔🍔         |\r\n| Locust结合 | 🍔🍔🍔🍔🍔 |\r\n| Mock     | 🍔             |\r\n\r\n\u003c/details\u003e\r\n\r\n\r\n[在线体验 🍍](https://pity.fun/)\r\n\r\n\u003cdetails open=\"open\"\u003e\r\n\u003csummary\u003e🌙 已有功能\u003c/summary\u003e\r\n\r\n| 功能点            | 状态  |\r\n|:---------------|:----|\r\n| 精美的邮件/钉钉通知模板   | ✅  |\r\n| 用例录制生成 🔥      | ✅   |\r\n| har导入 🔥       | ✅   |\r\n| http测试         | ✅   |\r\n| 测试集合           | ✅   |\r\n| 定时任务           | ✅   |\r\n| 全局变量           | ✅   |\r\n| 自定义脚本          | ✅   |\r\n| 场景测试           | ✅   |\r\n| 后台管理           | ✅   |\r\n| 文件上传测试         | ✅   |\r\n| 在线SQL          | ✅   |\r\n| 在线Redis        | ✅   |\r\n| 测试报告           | ✅   |\r\n| 项目管理           | ✅   |\r\n| 权限系统           | ✅   |\r\n| 串行/并行执行用例      | ✅   |\r\n| 参数提取           | ✅   |\r\n\r\n\u003c/details\u003e\r\n\r\n### 🚚 即将到来\r\n\r\n| 功能点          | 敬请期待 |\r\n|:-------------|:-----|\r\n| CI/CD        | 🎉🎉🎉   |\r\n| HttpRunner支持 | 🎉🎉🎉   |\r\n| 数据工厂         | 🎉🎉🎉   |\r\n| 精准测试         | 🎉🎉🎉   |\r\n| 组织架构         | 🎉🎉🎉   |\r\n| 用例评分         | 🎉🎉🎉   |\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e平台预览(点击可展开)\u003c/summary\u003e\r\n\r\n#### 🍦 工作台\r\n\r\n![](https://static.pity.fun/picture/2022-2-28/1646063228180-image.png)\r\n\r\n#### 测试计划\r\n\r\n![](https://static.pity.fun/picture/2022-2-25/1645803999678-image.png)\r\n\r\n#### 测试报告\r\n\r\n![](https://static.pity.fun/picture/2022-2-25/1645804075353-image.png)\r\n\r\n#### 测试用例\r\n\r\n![](https://static.pity.fun/picture/2022-2-25/1645804276470-image.png)\r\n\r\n#### 钉钉通知\r\n\r\n![](https://static.pity.fun/picture/20220813173821.png)\r\n\r\n\r\n#### SQL客户端\r\n\r\n![](https://static.pity.fun/picture/2022-2-25/1645804151559-image.png)\r\n\r\n#### 项目管理\r\n\r\n![项目管理](https://static.pity.fun/picture/2022-2-26/1645854332681-image.png)\r\n\r\n\u003c/details\u003e\r\n\r\n## ✉ 使用文档\r\n\r\n[使用文档(github)](https://wuranxu.github.io/pityDoc/)\r\n\r\n[备用地址(gitee)](https://woodywrx.gitee.io/pityDoc/)\r\n\r\n## 😊 开发参考文章\r\n\r\n[开发文档-公众号](https://mp.weixin.qq.com/mp/appmsgalbum?__biz=MzIyMjUwOTk5Mw==\u0026action=getalbum\u0026album_id=1983195471686762500\u0026scene=173\u0026from_msgid=2247484522\u0026from_itemidx=8\u0026count=3\u0026nolastread=1#wechat_redirect)\r\n\r\n[开发文档-掘金](https://juejin.cn/column/6977933898952998926)\r\n\r\n### 😢 关于Pity平台\r\n\r\npity是一款专注于api自动化的工具，采用`Python`+`FastApi`+`React`开发，目前还不能作为生产级别的工具，作者正在努力之中。\r\n\r\n这个项目叫pity，一个从0开始写的自动化测试平台(基于FastApi)，旨在总结自己最近几年的工作经验，也顺便帮助大家进步。目前还在火热更新中，基本上每周都会更新几篇吧，前期以教学+编码为主，后期以实现功能为主。希望大家能够喜欢！~\r\n\r\n项目起源是本人很期待的某家公司🐧拒绝了我，觉得特别遗憾吧😅。加上这一年`浑浑噩噩`的，也没有什么产出，做的东西不如18，19年多。所以打算把自己18-19的项目重写出来，给大家一些参考。\r\n\r\n### Docker部署\r\n\r\n1. 安装Docker Desktop\r\n2. 打开终端并进入pity目录\r\n3. 执行以下命令，安静等待pity启动即可（不需要额外安装mysql redis等，一键启动直接起飞）\r\n\r\n  **docker镜像由卫衣哥（QYZHG倾情制作👏👏👏）**\r\n\r\n```bash\r\ndocker-compose -f .\\ops\\docker-compose.yaml up\r\n```\r\n\r\n### 🎉 二次开发\r\n\r\n1. 拉取代码\r\n\r\n```bash\r\n$ git clone https://github.com/wuranxu/pity\r\n$ cd pity\r\n```\r\n\r\n2. 安装依赖\r\n\r\n```bash\r\n# 可换豆瓣源或者清华源安装依赖\r\n$ pip install -r requirements.txt\r\n```\r\n\r\n3. 安装并启动redis\r\n\r\n4. 安装并启动mysql\r\n\r\n5. 修改conf/dev.env\r\n\r\n修改其中mysql和redis连接信息，redis虽然可以不开启，但是会导致`定时任务重复执行`（基于redis实现了分布式锁）。\r\n\r\n6. 启动服务\r\n\r\n```bash\r\n$ python pity.py\r\n```\r\n\r\n7. 注册用户\r\n\r\n打开浏览器输入: `http://localhost:7777`进入登录页。\r\n\r\n点击注册按钮，第一个注册的用户会成为`超级管理员`，拥有一切权限。\r\n\r\n![](https://static.pity.fun/picture%2F%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220504235808.png)\r\n\r\n登录后就可以开启pity之旅啦！\r\n\r\n### 📞 作者介绍\r\n\r\n    大家好，我是米洛，一个乐于分享，喜欢钻研技术的测试开发工程师，目前就职于上海某互联网公司。\r\n\r\n    一个打游戏不拿首胜不睡觉的韭0后。\r\n\r\n    个人技术公众号: `米洛的测开日记`，欢迎大家关注我，掌握最新测试开发知识。\r\n\r\n![](https://static.pity.fun/picture/2022-1-1/1641020334827-qrcode_for_gh_f52fb2135f68_430.jpg)\r\n\r\n### ❤️ 平台初心\r\n\r\n虽说各大公司都有自己的接口测试平台，并且做的肯定比我的强。但是还是有`很多公司`，并没有这样的条件去投入人力专职开发接口测试平台。\r\n\r\n博主我在18年的时候接触到了Yapi这款接口文档管理工具，那是去哪儿团队开发的，但现在已经连官网都找不到了，仅仅只留下一个github.io的地址，让人叹息。\r\n\r\n扯远了，我看到他们大前端团队开源了如此一款精美的工具，内心也是激动万分。\r\n\r\n人活一辈子，并不长久，总得做些有意义的事情。虽然开源这件事情基本上没有什么收益可言，但总得有人做，世界才会`更美好`是不？\r\n\r\n所以我打算制作这样一款工具，面向的就是中小型公司，他们没有那么多时间/人力成本，甚至是测试资源较为匮乏，那么如果你来到了这儿，我想这款工具可以给你们带来帮助！如果是有一定的经验的Python测试开发，这款工具也可以给你带来一定的借鉴作用。\r\n\r\n### 💪 落地效果\r\n\r\n可能有人会怀疑项目是否能真正运用到生产系统里，这款工具其实是我在某大型共享单车公司实践2年多的一款工具。之前是golang开发，如今我离开那家公司，打算保留原本功能的基础之上进一步优化，并新增更多丰富的特性。所以大家可以放心，它绝对是一款能方便解决你api自动化测试的利器。\r\n\r\n### 😊 已有功能\r\n\r\n+ [x] 🔥 完善的用户登录/注册机制，提供第三方(github)登录\r\n- [x] 🀄 完善的项目管理机制\r\n* [x] 🚴 结合FastApi，利用asyncio让Python代码也可以起飞\r\n- [x] 💎 完整的接口测试流程\r\n- [x] 📝 强大的数据构造器, 解决接口数据依赖问题\r\n- [x] 🎨 在线调试http请求，堪比网页版本postman\r\n- [x] 🍷 完善的全局变量机制，拒绝case中的死数据\r\n- [x] 🚀 速度还挺快的\r\n- [x] 🐍 在线redis请求\r\n- [x] 🐎 测试计划/集合\r\n- [x] 🙈 在线数据库ide，数据库管理功能\r\n- [x] 📰 漂亮的邮件通知\r\n- [x] 😹 定时构建测试用例\r\n- [x] 🐧 精美的测试报告展示页面\r\n\r\n## 🙋 待开发的功能\r\n\r\n- [ ] 💀 app管理功能，支持app的导入和导出\r\n\r\n* [ ] 😼 ~~代码覆盖率增量/全量统计功能~~\r\n\r\n- [ ] 🐘 微服务化\r\n- [ ] 🐄 数据工厂，强大的造数功能\r\n- [ ] 🐸 用例支持har，jmx等格式导入\r\n- [ ] 👍 CI/CD，类pipeline功能\r\n- [ ] 🌼 推送功能，支持钉钉/企信推送\r\n- [ ] 🌛 支持dubbo/grpc\r\n- [ ] 🐛 打通yapi\r\n- [ ] 🌽 等等等等\r\n\r\n### 赞助\r\n\r\n如果您觉得这个项目对你`有所帮助`，可以请我吃根辣条哦~或者帮忙点个star，让我创作更有动力！！！谢谢大家啦！\r\n\r\n![](http://oss.pity.fun/picture/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220513224046.jpg\r\n)\r\n\r\n![](http://oss.pity.fun/picture/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220513224054.jpg)\r\n\r\n### 🏅️ 金牌赞助商（排名不分先后）\r\n\r\n- All Fiction\r\n- Vic\r\n- 老虎哥\r\n- 晴天\r\n- 春熙路\r\n- 方总\r\n- 榜一大哥\r\n- 汤总\r\n- 我去热饭\r\n- Bluesqiang\r\n- 全国知名气人代练\r\n- 鸡哥\r\n\r\n## 🎨 微信交流群\r\n\r\n二维码会经常过期，可以加我个人微信: `wuranxu`，我拉你到群聊。\r\n\r\n![](https://static.pity.fun/picture/2022-1-2/1641097484952-ddff5bf23bdccaaf23fa227aa2e9957.jpg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuranxu%2Fpity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwuranxu%2Fpity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuranxu%2Fpity/lists"}