网站设置搜索时间,设计师培训ui设计,建设工程信息查询哪个网站好,外贸圈app-mini
https://github.com/zx490336534/pytest-mini
微信小程序自动化测试pytest插件/工具
基于MiniTest进行pytest改造
使用方法
准备测试小程序
根据miniprogram-demo项目介绍运行一次项目
成功运行后关闭
安装更新
pip install pytest-mini --upgrade引入插件…-mini
https://github.com/zx490336534/pytest-mini
微信小程序自动化测试pytest插件/工具
基于MiniTest进行pytest改造
使用方法
准备测试小程序
根据miniprogram-demo项目介绍运行一次项目
成功运行后关闭
安装更新
pip install pytest-mini --upgrade引入插件
新建conftest.py文件
from pytest_mini import pluginspytest_plugins plugins(待测试的小程序项目路径,微信开发者工具路径
)例如demo/cases/conftest.py
from pytest_mini import pluginspytest_plugins plugins(/Users/zhongxin/github/miniprogram-demo, # 待测试的小程序项目路径/Applications/wechatwebdevtools.app/Contents/MacOS/cli # 微信开发者工具路径
)编写页面对象
在demo/pages/components_page.py编写元素定位
from pytest_mini import Mini, Locatorclass ComponentsPage(Mini):view_container Locator(view, inner_text视图容器, desc组件页-视图容器)在conftest.py中添加
import pytest
from pages.components_page import ComponentsPagepytest.fixture(scopesession)
def components_page(mini):yield ComponentsPage(drivermini.driver)编写测试代码
demo/cases/test_home.py
import allurefrom pytest_mini import composecompose(feature小程序官方组件展示, story组件, title容器视图操作)
def test_view_container(components_page):with allure.step(点击容器视图):components_page.click(components_page.view_container)assert False, 故意失败,查看报告截图编写执行报告展示脚本
demo/cases/allure_debug.py
import os
import pytest
from pytest_mini.constant import Constanttest_cases [test_home.py] # 执行的脚本main_list [-s, -v,*test_cases,--durations0, --clean-alluredir,--alluredir, f{Constant().REPORT_PATH}/allure_results
]
pytest.main(main_list)
if not os.getenv(BUILD_URL):os.system(f{Constant.ALLURE_TOOL} serve {Constant().REPORT_PATH}/allure_results) # 本地执行执行测试
运行allure_debug.py文件
查看报告 报告截图
最后感谢每一个认真阅读我文章的人礼尚往来总是要有的虽然不是什么很值钱的东西如果你用得到的话可以直接拿走 这些资料对于【软件测试】的朋友来说应该是最全面最完整的备战仓库这个仓库也陪伴上万个测试工程师们走过最艰难的路程希望也能帮助到你