是否可以在python-unittest中生成魅力报告?

问题描述 投票:2回答:1

我在Pytest中找到了针对魅力报告的解决方案。但是我需要在python-unittest中生成魅力报告。有可能吗?

python selenium-webdriver python-unittest allure
1个回答
0
投票

通过添加诱人的装饰器

  • @ allure.story('故事/需求名称')
  • @ allure.feature('功能名称')
  • @@ allure.testcase(“测试用例名称”)

例如

def test_nameOfTheTest(self):
    with allure.step("Open browser"):

或您可以使用的定义

@allure.step("Open application") 
def open_application(self):

用于运行测试:

python -m pytest nameOftheFile.py(considering its in the root) --alluredir ./results

获得结果:

allure serve ./results/

希望这对您有帮助

© www.soinside.com 2019 - 2024. All rights reserved.