Git Product home page Git Product logo

ddddpytest's Introduction

🔗真希望你没见过什么世面,一生只爱我这张平凡的脸

带带弟弟pytest

本项目实现接口自动化的技术选型:Aiohttp+Pytest+Yaml+Excel+Smtplib 。 其中Aiohttp用于发送和处理HTTP协议的请求接口,Pytest作为测试执行器, YAML和Excel文件用于测试数据的管理和测试报告的生成,最后使用Smtplib发送测试报告邮件。

特征

  • 采用协程方式发送请求,提高了测试用例执行效率
  • 采用统一请求封装,session自动关联,支持多个session之间切换
  • 采用关键字驱动设计,测试数据易于维护
  • 自动渲染测试用例,自动处理请求中的文件,并能自动提取请求和响应中的内容进行断言
  • 项目运行时自动生成日志文件和测试报告,且自动发送测试报告邮件
  • Yaml文件可关联Excel文件,用于存储公共测试数据和测试数据
  • Yaml及Excel文件中可使用变量和调用Python函数,方便测试用例编写
  • 支持使用Python变量和文件变量,增加测试用例的灵活性
  • 支持MySQL数据库连接及操作,同时支持生成Mock数据,便于测试用例的编写

📢项目开发环境:win11+python3.10

部署

  1. 下载项目源码后,在根目录下找到requirements_dev.txt文件,然后通过 pip 工具安装项目运行依赖,执行命令:
pip3 install -r requirements_dev.txt
  1. debug/config/local.yaml文件中配置数据库参数和邮件参数。
  2. debug/db目录中找到user.sql并运行初始化数据库。
  3. debug/flask_app目录中运行api.py启动服务。
  4. 之后运行main.py,或在Terminal窗口cd到项目根目录后执行命令:
pytest

示例

from common.read.case import read_case
from debug import auto_request
from debug.script.conftest import parametrize


@parametrize(read_case("debug/testcase/method.yaml"))
async def test_get(case):
	await auto_request(case)
# method.yaml
- casename: get请求
  request:
    url: http://127.0.0.1:5000/get
    method: GET
    params:
      foo1: bar1
      foo2: bar2

支持

  1. 如果喜欢ddddpytest,欢迎在GitHub上进行Star。
  2. 本项目使用过程中遇到问题或一起交流学习欢迎添加我的微信或Telegram 进行沟通。

vx

ddddpytest's People

Contributors

3293406747 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ddddpytest's Issues

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.