python數(shù)據(jù)分析做網(wǎng)站百度總部投訴電話

-mini
https://github.com/zx490336534/pytest-mini
微信小程序自動(dòng)化測(cè)試pytest插件/工具
基于MiniTest進(jìn)行pytest改造
使用方法
準(zhǔn)備測(cè)試小程序
根據(jù)miniprogram-demo項(xiàng)目介紹運(yùn)行一次項(xiàng)目
成功運(yùn)行后關(guān)閉
安裝&更新
pip install pytest-mini --upgrade
引入插件
新建conftest.py文件
from pytest_mini import pluginspytest_plugins = plugins("待測(cè)試的小程序項(xiàng)目路徑","微信開(kāi)發(fā)者工具路徑"
)
例如demo/cases/conftest.py
from pytest_mini import pluginspytest_plugins = plugins("/Users/zhongxin/github/miniprogram-demo", # 待測(cè)試的小程序項(xiàng)目路徑"/Applications/wechatwebdevtools.app/Contents/MacOS/cli" # 微信開(kāi)發(fā)者工具路徑
)
編寫(xiě)頁(yè)面對(duì)象
在demo/pages/components_page.py編寫(xiě)元素定位
from pytest_mini import Mini, Locatorclass ComponentsPage(Mini):view_container = Locator('view', inner_text='視圖容器', desc='組件頁(yè)-視圖容器')
在conftest.py中添加
import pytest
from pages.components_page import ComponentsPage@pytest.fixture(scope="session")
def components_page(mini):yield ComponentsPage(driver=mini.driver)
編寫(xiě)測(cè)試代碼
demo/cases/test_home.py
import allurefrom pytest_mini import compose@compose(feature="小程序官方組件展示", story="組件", title='容器視圖操作')
def test_view_container(components_page):with allure.step("點(diǎn)擊容器視圖"):components_page.click(components_page.view_container)assert False, "故意失敗,查看報(bào)告截圖"
編寫(xiě)執(zhí)行&報(bào)告展示腳本
demo/cases/allure_debug.py
import os
import pytest
from pytest_mini.constant import Constanttest_cases = ["test_home.py"] # 執(zhí)行的腳本main_list = ['-s', '-v',*test_cases,'--durations=0', '--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") # 本地執(zhí)行
執(zhí)行測(cè)試
運(yùn)行allure_debug.py文件
查看報(bào)告
報(bào)告截圖
最后感謝每一個(gè)認(rèn)真閱讀我文章的人,禮尚往來(lái)總是要有的,雖然不是什么很值錢(qián)的東西,如果你用得到的話可以直接拿走:
這些資料,對(duì)于【軟件測(cè)試】的朋友來(lái)說(shuō)應(yīng)該是最全面最完整的備戰(zhàn)倉(cāng)庫(kù),這個(gè)倉(cāng)庫(kù)也陪伴上萬(wàn)個(gè)測(cè)試工程師們走過(guò)最艱難的路程,希望也能幫助到你!???