Advertisement

软件测试学习笔记:pytest-allure生成测试报告

阅读量:

pytest-allure生成测试报告

安装模块:pip install allure-pytest

复制代码
    # 第一步:生成xml数据
    pytest --alluredir=./report/xml testcase.py
    # 第二步:生成html文件
    allure generate --clean ./report/xml -o ./result/html

将截图加入到报告里

allure.attach(f, ‘图片名’, allure.attachment_type.JPG)

复制代码
    # -*- coding: utf-8 -*-
    ​
    from selenium import webdriver
    import allure
    ​
    browser=webdriver.Chrome()
    browser.get("https://www.baidu.com")
    try:
    browser.find_element_by_id("zhiyi").send_keys('test123456')  # 输入密码,
    except Exception as e:
    file_name = './test.jpg'
    browser.save_screen

全部评论 (0)

还没有任何评论哟~