Code Monkey home page Code Monkey logo

lunarlink's Introduction

LunarLink

GitHub License GitHub Release GitHub Repo stars GitHub forks Python Version Django Version Static Badge

平台简介

基于HttpRunner + Django + Vue + Element UI 的接口自动化测试平台,生产可用。

此外,非常感谢 花菜。没有 AnotherFasterRunner 就不会有 LunarLink :)

技术栈

  • 🎨 Django
  • 🎶 Django Rest framework
  • 🎉 Vue.js
  • 🎃 Element UI
  • 🏐 django-celery-beat(定时任务)
  • 🎲 Nginx(反向代理,https配置等)
  • 👟 HttpRunner(测试用例执行引擎)
  • 🔒 RabbitMQ
  • 🚚 Redis
  • 💎 MySQL
  • ⛏ Docker

功能模块

  • 登录:账号认证、用户管理、权限管理
  • 项目管理:新增项目、列表展示及相关操作,支持项目看板,显示项目每日、每周、每月不同维度数据
  • 项目概览:项目基本信息,API、测试用例、任务执行总览,每日明细
  • 接口管理:一个API对应后端一个HTTP接口,API可以单独运行,也可以作为一个用例步骤,支持API分组、参数提取、数据断言、变量引用、前后置钩子函数、接口调试、日志显示
  • 接口导入:支持同步YApi (以YApi 做媒介间接支持Swagger、Postman、Har),无需手动录入接口
  • 测试用例:支持分组管理,由多个API组成,支持关联接口的动态参数传递,不区分场景用例和单接口用例,支持同步、异步批量执行,生成测试报告
  • 流量录制:为了适配复杂流程的接口测试场景,打开浏览器,进行一系列操作,就可以得到一个测试用例,不同接口之间的参数自动提取并关联
  • 配置管理:自定义不同配置的请求base_url地址,公共请求头参数、局部变量、前后置钩子函数、参数化内容,API和用例可以选择不同配置执行
  • 全局变量:定义变量供API使用,变量值也可以引用驱动代码中的函数,通用账号、秘钥可以定义在此处
  • 驱动代码:支持Python脚本,定义前后置钩子函数、辅助函数可以轻松实现请求参数签名,加密和解密响应等功能
  • 定时任务:可设置定时任务,遵循crontab表达式,可在线开启、关闭,用例执行支持串行、并行,完成后测试报告推送企业微信
  • 历史报告:保存定时、调试、异步等不同类型的测试报告,可在线查看、筛选、删除,还可查看他人测试报告

在线体验

👩‍👧‍👦 演示地址:http://47.119.28.171:8081

  • 体验账号:test
  • 密码:test2023

准备工作

Python >= 3.9.5 (推荐3.9.x版本)
nodejs >= 16.0 (推荐最新)
Mysql >= 5.7.0 (推荐5.7.x版本)
RabbitMQ >= 3.x-management(默认需要,推荐最新版)
Redis >= 6.2.6

前端 ♝

建议使用yarn,项目提供了yarn.lock,使用其他包管理器,容易出现版本依赖问题。

# 克隆项目
git clone https://github.com/tahitimoon/LunarLink.git

# 进入项目目录
cd LunarLink/frontend

# 安装依赖
yarn install --registry=https://registry.npmmirror.com

# 启动服务
yarn start
# 浏览器访问 http://127.0.0.1:8888
# config/index.js 文件可配置启动端口等参数
# config/dev.env.js 文件可配置后端接口地址
# config/prod.env.js 文件保持不变
# 构建生产环境
# yarn build

后端 💈

# 克隆项目
git https://github.com/tahitimoon/LunarLink.git

# 进入项目目录
cd LunarLink/backend

# 将.env.example文件重命名为.env 并配置相关参数
mv .env.example .env

# 安装依赖环境
pip3 install -r requirements.txt

# 执行迁移命令:
python3 manage.py makemigrations
python3 manage.py migrate

# 创建管理员用户
python3 manage.py createsuperuser

# 启动项目
python3 manage.py runserver

# 开启流量录制代理
python3 proxy.py

访问项目

# 登录管理后台,设置账号姓名
http://127.0.0.1:8000/admin/

# 浏览器打开
http://127.0.0.1:8888
用户/密码:管理员用户/密码

# 接口文档地址
http://127.0.0.1:8000/swagger/

开启定时/异步任务

# 启动celery,在控制台执行
celery -A backend worker -B --loglevel=info

演示图 ✅

Docker构建

请参考文档Docker构建

lunarlink's People

Contributors

tahitimoon avatar

Stargazers

Solon avatar XBaiLong avatar xxiaojiee avatar  avatar  avatar  avatar  avatar daysdays avatar YIMING LIU avatar cut avatar JunedQQ avatar 于先森(Mr.Yu) avatar  avatar yingmu avatar  avatar lemmmmmmmmm avatar  avatar  avatar Alchemist avatar qiujianzhong avatar  avatar felix avatar  avatar  avatar neotame c avatar 张涛 avatar HuangDz avatar  avatar guoyucn avatar  avatar peikaiqiang avatar  avatar liukersun avatar Lifeek avatar  avatar yjz0065 avatar Geass avatar 港口 avatar 光子 avatar  avatar 江鹏利 avatar fawaikuangtuzhangfei avatar leo wang avatar qianye avatar  avatar stevensunzh avatar Purseccc avatar  avatar oliver avatar  avatar  avatar Pang avatar mlq avatar  avatar 二进制 avatar Matthew Chow avatar pursuit avatar KyleCe avatar  avatar  avatar  avatar  avatar Burt Li avatar Bulbasaur.Yan avatar Simon Song avatar  avatar  avatar ETMU avatar fire avatar  avatar Tony ⁺ avatar Andrew Wang C avatar Larry Chen avatar  avatar 半卷书 avatar sonic666 avatar Harley Wessling avatar MxOnline avatar nice try avatar Iqiuz Zixuan avatar MingYuan avatar  avatar  avatar  avatar allen.hu avatar cousepig avatar  avatar  avatar  avatar Latin avatar  avatar vv avatar  avatar xuyanghaha avatar  avatar  avatar  avatar  avatar wangming avatar Harriet Wolff avatar

Watchers

 avatar  avatar  avatar

lunarlink's Issues

运行迁移命令报错,大佬给看下呗

django.setup()

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/init.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/log.py", line 75, in configure_logging
logging_config_func(logging_settings)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/config.py", line 795, in dictConfig
dictConfigClass(config).configure()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/config.py", line 549, in configure
'filter %r: %s' % (name, e))
ValueError: Unable to configure filter 'request_id': Cannot resolve 'log_request_id.filters.RequestIDFilter': No module named 'log_request_id'
macdeMacBook-Pro-6:backend mac$

能否提供showdoc的导入呢?

showdoc是和yapi类似的接口管理平台,目前项目中使用showdoc做文档管理,请问作者有计划接入showdoc的导入吗?

yapi导入异常

使用rabbitmq 链接失败, 将celery 的后端broker 改成redis 的链接成功,redis 中也可以看到相关的信息,

 INFO [pid:31004] [basehttp.py->log_message:161] "POST /api/lunarlink/yapi/1 HTTP/1.1" 200 149
2024-04-09 09:23:52,401 [none] django.server INFO [pid:31004] [basehttp.py->log_message:161] "OPTIONS /api/lunarlink/tree/1?type=1 HTTP/1.1" 200 0
2024-04-09 09:23:52,714 [d0795e6da284401991b3af8049b8185c] lunarlink.utils.decorator INFO [pid:31004] [decorator.py->inner_wrapper:32] before process request params:
{
    "type": "1"
}
2024-04-09 09:23:52.715 | INFO     | crud.crud_helper:get_or_create:43 - input get_or_create=Relation, filter_kwargs={'project_id': 1, 'type': 1}, defaults={'tree': [{'id': 1, 'label': '默认目录', 'children': []}], 'project_id': 1}
2024-04-09 09:23:52.750 | INFO     | lunarlink.services.tree_service_impl:get_or_create:49 - tree exist project_id=1 type=1
2024-04-09 09:23:52,847 [d0795e6da284401991b3af8049b8185c] django.server INFO [pid:31004] [basehttp.py->log_message:161] "GET /api/lunarlink/tree/1?type=1 HTTP/1.1" 200 166
2024-04-09 09:23:52,423  INFO  [pid:38720] [celery.worker.strategy strategy.py->task_message_handler:161] Task lunarlink.tasks.async_import_yapi_api[2e0dd4f2-ebbb-4dd9-a507-3afbc8f1b81f] received[2024-04-09 09:23:54,145: INFO/SpawnPoolWorker-27] child process 22544 calling self.run()

另外windows下rotation 写00:00 会报错 ,且需要加 enqueue=True
最后yapi 导入接口 还是没有
image

增加生成单接口测试用例的功能

1.一个全新的平台,无论是使用swagger 接口导入还是使用yapi 导入, 导入的都只是接口, 由单接口而需要产生的测试用例并没有, 光导入了接口, 然后单接口的测试用例还是要自己一个个的拖拉拽去生成, 这一步的操作反而更浪费时间

2.另外默认的状态码校验这个是否支持全局配置 配置,举例,系统只要接口通了 http码就是200 ,但是实际可能是根据响应的data 里面的code 去判断是否业务有异常

1里面的步骤暂时可能需要使用已有的系统添加的接口去写代码 先生成一波
2. 这个可能是要对导入yapi 时进行修改源代码进行校验的修改

接口录制

如果项目部署在服务器上,想要录制我浏览器上的请求需要怎么配置呢? ip填服务器的ip, 端口填7778 ? 本地录制还是远端呢? 本地还会启动一个vpn 用于访问内网私有域名

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.