pytest-2:allure 的安装、使用

版本对应:

python3.4==>allure-pytest2.7.0

python3.6==>allure0pytest2.8.6

环境安装:

1.先安装好对应的python,准备好pytest脚本

2.安装allure-pytest

pip install allure-pytest==version(python适配的版本号)

3.下载allure命令行工具

github地址--可以下载最新版本:

https://github.com/allure-framework/allure2/releases

把解压后的文件存放到一个目录下

在path中添加环境变量

 在cmd命令窗口中输入以下命令,出现版本号则可以执行下一步

allure --version

切换到pytest脚本目录下,

执行存放allure报告的路径命令:

pytest --alluredir ./report/allure_raw

cmd中运行报告:

allure serve report/allure_raw

========================================================================

要在allure报告上显示内容的语法:

先在脚本中导入allure

# 在报告上显示的模块名
@allure.feature("===login===")
class TestLogin():
    # 在报告上显示的用例名
    @allure.story("==test_login==")
    def test_login(self):
        chrome_options = webdriver.ChromeOptions()

# 在报告上显示的步骤名
@allure.step("==test_login==")

猜你喜欢

转载自www.cnblogs.com/mufenglin/p/12080105.html