app自动化测试框架(六、标记失败用例)

@pytest.mark.xfail

场景一、某个用例已知bug、某个功能未开发完成。期望执是失败的

import pytest
from page_obj.login_page import LoginPage
import allure

xfail=pytest.mark.xfail(1==1,reason='功能未开发完成')

@allure.feature("登录模块")
@pytest.mark.smoke
class TestLogin:

    @allure.title("成功登录")
    def test_login_success(self, app_page):
        LoginPage(app_page).login('xxxxxxx', 'xxxxxx')
        assert 1 == 1
    @xfail
    @allure.title("失败登录")
    def test_login_error2(self, app_page):
        assert  1 == 2

    @xfail
    @allure.title("失败登录2")
    def test_login_error3(self, app_page):
        assert  1 == 1
image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容