(实践记录三)appium自动化po模式之main函数pytest运行cases

(实践记录三)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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值