Metadata-Version: 2.1
Name: gastepo
Version: 0.0.2
Summary: An base-on Schema DSL automation framework of Restful API.
Home-page: https://github.com/bleiler1234/Gastepo
License: MIT
Keywords: schema,dsl,restful,api,test,pytest,allure,pandas,jsonpath,hamcrest
Author: yuzhonghua
Author-email: 583512498@qq.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Dist: Flask (>=1.1.1,<2.0.0)
Requires-Dist: PyHamcrest (>=2.0.2,<3.0.0)
Requires-Dist: PyMySQL (>=0.9.3,<0.10.0)
Requires-Dist: PyYAML (>=5.3.1,<6.0.0)
Requires-Dist: SQLAlchemy (>=1.3.9,<2.0.0)
Requires-Dist: aiofiles (>=0.5.0,<0.6.0)
Requires-Dist: allure_pytest (>=2.8.6,<3.0.0)
Requires-Dist: allure_python_commons (>=2.8.6,<3.0.0)
Requires-Dist: colorlog (>=4.0.2,<5.0.0)
Requires-Dist: emoji (>=1.2.0,<2.0.0)
Requires-Dist: fastapi (>=0.58.1,<0.59.0)
Requires-Dist: jenkins (>=1.0.2,<2.0.0)
Requires-Dist: jsonpath (>=0.82,<0.83)
Requires-Dist: openpyxl (>=3.0.0,<4.0.0)
Requires-Dist: pandas (>=1.2.3,<2.0.0)
Requires-Dist: pycryptodome (>=3.9.7,<4.0.0)
Requires-Dist: pymongo (>=3.9.0,<4.0.0)
Requires-Dist: pytest (>=5.3.2,<6.0.0)
Requires-Dist: redis (>=3.5.3,<4.0.0)
Requires-Dist: requests (>=2.22.0,<3.0.0)
Requires-Dist: retrying (>=1.3.3,<2.0.0)
Requires-Dist: rsa (>=4.0,<5.0)
Requires-Dist: selenium (>=3.141.0,<4.0.0)
Requires-Dist: uvicorn (>=0.11.5,<0.12.0)
Requires-Dist: xlrd (>=1.2.0,<2.0.0)
Requires-Dist: xlutils (>=2.0.0,<3.0.0)
Requires-Dist: xlwt (>=1.3.0,<2.0.0)
Requires-Dist: xmltodict (>=0.12.0,<0.13.0)
Project-URL: Documentation, https://bleiler1234.github.io/Gastepo
Project-URL: Repository, https://github.com/bleiler1234/gastepo
Description-Content-Type: text/markdown

### Description

> **框架简介：** Gastepo ~ 基于Schema DSL语法规约的接口自动化测试框架

> **测试类型：** 接口自动化测试

***

### Feature

* **开发语言**：*Python 3.7*
* **开发环境**：*PyCharm*
* **开发工具**：
  * 测试框架：*Pytest*
  * 测试报告：*Allure*
  * 数据处理：*Pandas*
  * 请求工具：*Requests*
  * 响应获取：*JsonPath*
  * 断言工具：*Hamcrest*
  * 单元测试：*Unittest*、*Coverage*
  * 代码扫描：*SonarQube*
  * Web服务：*Flask*、*FastApi*
  * 部署方式：*Docker*、*Jenkins*

***

### Framework

<img src="https://i.loli.net/2021/04/26/qsx8IdGPyQKc5fp.png" alt="Framework.png" style="zoom:55%;" />

***


### Schema

- *Dependency Schema*

```json
[
    {
        "GET /v3_0/userInfo/searchContactUsers": {
            "to_path": {},
            "to_header": {},
            "to_param": {},
            "to_data": {
                "$['idCardNo']": {
                  	"GET /v3_0/getCardId": {
                      	"response": {
                          	"data": "$.data.cardId"
                        }
                    }
                }
            }
        }
    }
]
```

- *Assertion Schema*

```json
[
    {
        "actual": "$.data[:].cardId",
        "expect": [
          {
            "${fetchCardId(user)}": {
              "user": {
                "GET /v3_0/getUserName": {
                  	"response": {
                      	"data": "$.userName"
                    }
                }
              }
            }
          }
        ],
        "matcher": "has_item",
        "alert": "未发现指定用户标签ID",
        "multi": false
    }
]
```

***

### Test Runner

```ini
[pytest]
addopts = -s -q --alluredir=./Common/Static/Result/Allure --disable-warnings
testpaths = ./Executor/Mente
python_files = *Runner.py
python_classes = Test*
python_functions = test*
```

- **Automation Runtime**
    - *Step_1*：自动分析指定扫描文件夹中所有Postman接口集合并聚合生成表格用例文件。
    - *Step_2*：自动化测试用例支持用例筛选及BDD方式执行，单条用例支持激活或禁用。
    - *Step_3*：自动化测试用例使用Dependency Schema规约结构的接口请求数据依赖。
    - *Step_4*：自动化测试用例使用Assertion Schema规约结构的接口信息高级断言。
    - *Step_5*：自动化测试运行支持前置清空历史测试数据，包括测试结果、用例结果等。
    - *Step_6*：自动化测试运行的所有接口通过dispatch路由分发，可自动识别请求信息并注入依赖数据。
    - *Step_7*：自动化测试报告使用Allure，并支持表格用例自动更新、接口信息实时录制、报告实时截图。
    - *Step_8*：自动化测试推送通知方式支持传统邮件推送和钉钉机器人消息提醒。
    - *Step_9*：自动化测试部署方式支持Jenkins流水线及Docker容器托管运行方式。

***

### Test Reporter

```shell
allure generate {json测试结果目录} -o {html测试报告目录} --clean
```

- <u>**Allure Test Report**</u>

![Gastepo](https://i0.hdslb.com/bfs/album/5d05d78fb0f38fd9954d7e350ace89fe564c44d0.png)

***

### Test Deployment

- <u>**Docker Container**</u>

```shell
docker run -itd --name gastepo -p 端口号 -v {配置文件映射卷} -v {数据文件映射卷} automation/gastepo
```

- <u>**Jenkins Pipeline**</u>

```groovy
pipeline {
    agent any
    options {
        可选项配置
    }
    stages {
         stage("Pull From GitLab") {
        		拉取指定Git分支源码
        }
        stage("Set PATH") {
            设置Python3依赖信息
        }
        stage("Run Test") {
            执行自动化测试
        }
        stage("Generate Report") {
            报告生成及结果推送
    }
    post {
        success {
            println "[Done]: Gastepo Test Done"
        }
    }
}
```

***

### Wiki:

Get me on [GitHub](https://github.com/bleiler1234/gastepo)

***

### Measure

[![警报](http://10.16.168.70:9005/api/project_badges/measure?project=TaslyAutoTest&metric=alert_status)](http://10.16.168.70:9005/dashboard?id=TaslyAutoTest)[![SQALE评级](http://10.16.168.70:9005/api/project_badges/measure?project=TaslyAutoTest&metric=sqale_rating)](http://10.16.168.70:9005/dashboard?id=TaslyAutoTest)[![覆盖率](http://10.16.168.70:9005/api/project_badges/measure?project=TaslyAutoTest&metric=coverage)](http://10.16.168.70:9005/dashboard?id=TaslyAutoTest)

[^QA]: 583512498@qq.com


