Описания(description)
Вы можете добавить подробное описание тестов, чтобы предоставить читателю отчета столько контекста, сколько вам нужно. Это можно сделать несколькими способами: вы можете добавить @allure.description
декоратор, предоставляющий строку описания, или вы можете использовать @allure.description_html
его для предоставления некоторого HTML-кода, который будет отображаться в разделе «Описание» тестового примера. В качестве альтернативы описание будет просто взято из строки документации метода тестирования.
import allure
@allure.description_html("""
<h1>Test with some complicated html description</h1>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr align="center">
<td>William</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr align="center">
<td>Vasya</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
""")
def test_html_description():
assert True
@allure.description("""
Multiline test description.
That comes from the allure.description decorator.
Nothing special about it.
""")
def test_description_from_decorator():
assert 42 == int(6 * 7)
def test_unicode_in_docstring_description():
"""Unicode in description.
Этот тест проверяет юникод.
你好伙计.
"""
assert 42 == int(6 * 7)
Также описания могут динамически обновляться из тела теста с помощью allure.dynamic.description
.
allure.dynamic.description
.import allure
@allure.description("""
This description will be replaced at the end of the test.
""")
def test_dynamic_description():
assert 42 == int(6 * 7)
allure.dynamic.description('A final description.')
Last updated
Was this helpful?