(實踐記錄三)appium自動化PO模式之main函數pytest運行cases
# -*- coding:utf-8 -*-
import pytest
import os
import allure
import logger
from Cases.mydriver import mydriver
from Pages import searchpage,fcirclepage
#實例化封裝的Logger
LOG=logger.Logger("TestDemo").getlog()
class TestDemo:
def setup(self):
LOG.debug("TEST START")
self.driver=mydriver()
#測試搜索聯繫人功能
@pytest.mark.parametrize("name",["h","ha"])
def test_search_contact(self,name):
LOG.debug("test_search_contact")
search=searchpage.search(self.driver)
search.search_contacts(name)
#測試發表文字功能
def test_publish_word(self):
LOG.debug("test_publish_word")
publish=fcirclepage.fcirclepublish(self.driver)
publish.publish_word()
def teardown(self):
LOG.debug("TEST FINISH")
self.driver.quit()
if __name__ == '__main__':
#存放xml、html的報告路徑
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
file_result = path + "/result/xml"
file_report=path+"/result/html"
#pytest+allure執行腳本,生成測試報告
pytest.main(['-s', '-q', '--alluredir', file_result])
#查看測試報告的方法
#print("cmd下生成HTML報告:"+"allure generate "+ file_result+" -o "+file_report+" --clean")
#print("查看HTML報告:"+"allure open -h 127.0.0.1 -p 8083 "+file_report)
(實踐記錄三)appium自動化po模式之main函數pytest運行cases
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.