19 Star 167 Fork 55

XiangjunZhao475720456 / QAPlatform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

QAPlatform

1、介绍

小星星

2、软件架构

QAPlatform 使用Python3进行开发,主要选用了 django+django rest framework(简称:drf)+pymysql+redis+celery+uwsgi 框架组合。

  • django+drf:提供restful风格的API接口服务
  • pymsql:提供mysql数据库持久化功能
  • redis:提供数据缓存功能
  • celery:提供定时任务及异步任务功能
  • requests:提供http接口测试功能

3、部署教程

本次部署环境为CentOS7操作系统。Windows操作系统,请参阅README.windows.md文档。
本项目采用docker+mysql+redis+nginx+uwsgi进行部署;其中redis、mysql、nginx使用了docker部署,用户可以使用自己熟悉的方式安装redis、mysql、nginx。

3.1、CentOS7安装docker

yum install -y epel-release docker-io

3.2、docker安装redis

docker run -d --name redis -p 6379:6379 --restart=always docker.io/redis:latest

3.3、docker安装mysql

安装mysql数据库
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root --restart=always -v /var/lib/mysql:/var/lib/mysql docker.io/mysql:5.7.28

3.4、docker安装nginx,部署前端程序

docker run -d --name nginx -p 80:80 --restart=always docker.io/nginx

# 注意:结合部署环境的情况,修改nginx配置如下
# 1、修改QAPlatform部署的服务器IP以及服务监听的端口
# 示例:系统部署的服务器ip为172.17.0.1;uwsgi.ini设置的程序端口为8000,那么upstream QAPlatform配置如下代码所示
upstream QAPlatform {
    # ip使用部署服务器的ip或域名,端口与uwsgi.ini设置的端口保持一致
    server 172.17.0.1:8000;
}

# 2、修改nginx监听的端口,默认监听的是80端口
# 示例:nginx监听的端口为80,那么server listen配置如下代码所示
server {
    listen 80;
}

# 3、将 nginx配置文件 目录下的nginx-socket.conf更名为nginx.conf;再将nginx.conf拷贝到nginx容器的/etc/nginx目录中
docker cp ./nginx配置文件/nginx.conf nginx:/etc/nginx

# 4、将已打包的前端程序dist目录中的文件拷贝到nginx容器的/home/QAPlatformWeb目录中
docker cp ./dist nginx:/home/QAPlatformWeb

# 5、将nginx服务重新加载
docker exec nginx nginx -s reload

3.5、安装Python、Pip环境,创建虚拟环境

一、安装Python环境
# 1、安装依赖
sudo yum install -y libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel zlib gcc make

# 2、下载Python程序
# Python包地址:https://www.python.org/ftp/python/
wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz

# 3、解压Python-3.8.13.tgz
tar -zxvf Python-3.8.13.tgz

# 4、编译安装
sudo mkdir /usr/local/python3.8.13
cd Python-3.8.13
sudo ./configure --prefix=/usr/local/python3.8.13
sudo make && sudo make install

# 5、建立软链接
sudo ln -s /usr/local/python3.8.13/bin/python3 /usr/bin/python3
sudo ln -s /usr/local/python3.8.13/bin/pip3 /usr/bin/pip3

# 6、验证安装
python3 -V
pip3 -V

二、安装虚拟环境、创建虚拟环境
# 1、安装虚拟环境virtualenv
yum install -y python-virtualenv

# 2、创建虚拟环境
# 在项目根目录创建虚拟环境
virtualenv -p python3 venv

# 3、激活虚拟环境
source ./venv/bin/activate

# 4、退出虚拟环境
deactivate

3.6、安装项目依赖

# 在激活的虚拟环境中安装项目依赖
# 在requirements.txt所在目录中执行以下命令
pip install -r requirements.txt

3.7、迁移数据库,导入初始数据

# 创建数据库
# 1、进入mysql docker容器
docker exec -it mysql /bin/bash
# 2、登录mysql数据库
mysql -uroot -proot
# 3、创建QAPlatform数据库
CREATE DATABASE IF NOT EXISTS QAPlatform DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
# 注:本项目的数据库名为:QAPlatform,用户名为:root,密码为:root;用户可根据实际需求,创建相应的数据库以及用户名和密码,并且在项目的QAPlatform/settings.py文件中修改数据库配置,保持一致即可。

# 执行迁移数据库,在manage.py所在目录执行以下命令
python manage.py makemigrations
python manage.py migrate

# 数据库迁移成功生成表后,执行 sql 文件夹中的脚本,导入初始数据
# 执行顺序:basic_user.sql、basic_role.sql、basic_user_roles.sql、basic_markdown.sql、basic_permission.sql

4、使用说明

4.1、启动、停止uwsgi服务

# 启动服务,参数-d代表后台运行
uwsgi -d --ini uwsgi.ini

# 重新加载服务
uwsgi --reload uwsgi.pid

# 停止服务
uwsgi --stop uwsgi.pid

4.2、启动定时服务celery

# 在项目QAPlatform目录中执行以下命令,启动celery定时服务
nohup celery worker -A QAPlatform --loglevel=info --pool=solo --pidfile=celery-worker.pid --logfile=./logs/celery-worker.log &

4.3、启动定时调度服务django_celery_beat

# 在项目QAPlatform目录中执行以下命令,启动celery定时调度服务
nohup celery beat -A QAPlatform --loglevel=info --scheduler django_celery_beat.schedulers:DatabaseScheduler --pidfile=celery-beat.pid --logfile=./logs/celery-beat.log &

5、前端界面展示

5.1、定时任务服务

  • 5.1.1、Crontab日程列表
    Crontab日程列表
  • 5.1.2、添加Crontab
    添加Crontab
  • 5.1.3、定时任务列表
    定时任务列表
  • 5.1.4、添加定时任务
    添加定时任务

5.2、接口自动化测试

  • 5.2.1、环境列表
    环境列表

  • 5.2.2、创建环境
    创建环境

  • 5.2.3、项目列表
    项目列表

  • 5.2.4、编辑项目
    编辑项目

  • 5.2.5、模块列表
    模块列表

  • 5.2.6、接口列表
    接口列表

  • 5.2.7、创建接口—基础信息
    创建接口—基础信息

  • 5.2.8、创建接口—Headers参数定义
    创建接口—Headers参数定义

  • 5.2.9、创建接口—Body参数定义
    创建接口—Body参数定义

  • 5.2.10、创建接口—用例期望结果定义
    创建接口—用例期望结果定义

  • 5.2.11、EXCEL导入接口和用例模板
    EXCEL导入接口和用例模板

  • 5.2.12、EXCEL导入接口和用例
    EXCEL导入接口和用例

  • 5.2.13、扩展方法列表
    扩展方法列表

  • 5.2.14、用例列表
    用例列表

  • 5.2.15、创建用例
    创建用例

  • 5.2.16、导入用例
    导入用例

  • 5.2.17、编辑调试用例—基础信息
    编辑调试用例—基础信息

  • 5.2.18、编辑调试用例—Headers参数
    编辑调试用例—Headers参数

  • 5.2.19、编辑调试用例—Body参数
    编辑调试用例—Body参数

  • 5.2.20、编辑调试用例—期望结果
    编辑调试用例—期望结果

  • 5.2.21、编辑调试用例—调试用例
    编辑调试用例—调试用例

  • 5.2.22、场景列表
    场景列表

  • 5.2.23、创建场景—基础信息
    创建场景—基础信息

  • 5.2.24、创建场景—全局参数配置
    创建场景—全局参数配置

  • 5.2.25、场景组织用例
    场景组织用例

  • 5.2.26、场景集列表
    场景集列表

  • 5.2.27、场景集组织场景
    场景集组织场景

  • 5.2.28、测试结果—用例结果列表
    测试结果—用例结果列表

  • 5.2.29、测试结果—用例结果详情
    测试结果—用例结果详情

  • 5.2.30、测试结果-场景结果列表
    测试结果-场景结果列表

  • 5.2.31、测试结果—场景结果详情
    测试结果—场景结果详情

  • 5.2.32、测试报表
    测试报表

  • 5.2.33、用例测试报告
    用例测试报告

  • 5.2.34、场景测试报告
    场景测试报告

  • 5.2.35、帮助文档
    帮助文档

6、捐赠

如果对您有帮助,请微信扫码,捐赠以表支持,谢谢

捐赠

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

HTTP接口测试平台 展开 收起
Python 等 3 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/xiangjunzhao/QAPlatform.git
git@gitee.com:xiangjunzhao/QAPlatform.git
xiangjunzhao
QAPlatform
QAPlatform
master

搜索帮助