first commit
基于 playwright 和 pytest 单元测试框架的自动化项目
$ pip install -r requirements.txt
依赖库
playwright==1.36.0 pytest-playwright==0.4.2 pytest==7.4.0 pytest-html==3.2.0 pytest-rerunfailures==10.2 seldom==3.2.3
注:安装requirements.txt指定依赖库的版本,这是经过测试的,有时候新的版本可会有错。
requirements.txt
在 config.py 文件配置
config.py
class RunConfig: """ 运行测试配置 """ # 运行测试用例的目录或文件 cases_path = "test_cases/test_001.py" # 配置浏览器驱动类型(chromium, firefox, webkit)。 browser = "chromium" # 运行模式(headless, headful) mode = "headful" # 配置运行的 URL url = "https://www.baidu.com" # 失败重跑次数 rerun = "0" # 当达到最大失败数,停止执行 max_fail = "5"
运行测试
$ python run.py
基于pytest+playwright的自动化测试框架
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
playwright-master
实现功能
安装依赖库
依赖库
注:安装
requirements.txt
指定依赖库的版本,这是经过测试的,有时候新的版本可会有错。配置
在
config.py
文件配置运行
运行测试