You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?
The name of the step is not dynamic and cannot be natively changed/updated during test execution. Unlike the test description (allure.dynamic.description), for example
What is the expected behavior?
Ability to update the name of the step during the test execution.
What is the motivation / use case for changing the behavior?
I am using allure-pytest-bdd and defining a markdown table as part of the step description. In the allure report the markdown table is automatically included as part of the step name and is presented as a 'wall of text' which is difficult to read for the user.
For example:
Feature: Joining logic
Scenario: Join customers with orders
Given I have a customers dataframe:
| cusomterid | customername |
| 1 | Company A |
| 2 | Company B |
And I have a orders dataframe:
| orderid | orderamount | customerid
| 1 | 100 | 1 |
| 2 | 200 | 2 |
When I join the dataframes Then The resulting dataframe is: | customerid | customername | orderid | orderamount | | 1 | Company A | 1 | 100 | | 2 | Company B | 2 | 200 |
This is rendered on the Allure report as follows:
The markdown table text is rendered on a single line which makes the descriptive test name (e.g. "I have a customers dataframe") difficult to read as the line is cluttered by the table.
My suggested work around was to add the markdown table as an Text attachment which is easy to read/format and then update the name of the step to remove the markdown table text. For example, just keep the first line -- "I have a customers dataframe".
However, it doesn't seem possible to update the name of the step dynamically as part of the test.
I would be very happy to work on a PR for this.
Please tell us about your environment:
Allure version: 2.13.5
Test framework: pytest-bdd==6.1.1
Allure adaptor: allure-pytest-bdd==2.13.1
Other information
Here is some example code for the above scenario
importfunctoolsimportallurefrompytest_bddimportgivenfrompytest_bddimportparsersfrompytest_bddimportscenariosfrompytest_bddimportthenfrompytest_bddimportwhenscenarios("../features/joins.feature")
defparse_data_table(text):
parsed_text= [
[x.strip() forxinline.split("|")]
forlinein [x.strip("|") forxintext.splitlines()]
]
header, *data=parsed_textreturn [dict(zip(header, line)) forlineindata]
defdatatable(name, fixture="data"):
formatted_str="{name}\n{{{fixture}:DataTable}}".format(
name=name,
fixture=fixture,
)
data_table_parser=functools.partial(parse_data_table)
returnparsers.cfparse(formatted_str, extra_types=dict(DataTable=data_table_parser))
@given(datatable("I have a customers dataframe:"), target_fixture="customers")defparse_customers_dataframe(data):
# just saving dataframe as string for now, but would convert to pandas/sparkallure.attach(str(data), "customers dataframe", allure.attachment_type.TEXT)
# update step name as part of test to remove markdown table# e.g. allure.dynamic.step("I have a customers dataframe")returndata@given(datatable("I have a orders dataframe:"), target_fixture="orders")defparse_orders_dataframe(data):
# just saving dataframe as string for now, but would convert to pandas/sparkallure.attach(str(data), "orders dataframe", allure.attachment_type.TEXT)
returndata@when("I join the dataframes", target_fixture="joined_df")defjoin_dataframes(customers, orders):
# joining logicreturncustomers@then(datatable("The resulting dataframe is:"))deffinal_dataframe(joined_df, data):
allure.attach(str(data), "Joined dataframe", allure.attachment_type.TEXT)
# make assertion of joined_df vs table provided in step description
The text was updated successfully, but these errors were encountered:
I'm submitting a ...
What is the current behavior?
The name of the step is not dynamic and cannot be natively changed/updated during test execution. Unlike the test description (
allure.dynamic.description
), for exampleWhat is the expected behavior?
Ability to update the name of the step during the test execution.
What is the motivation / use case for changing the behavior?
I am using
allure-pytest-bdd
and defining a markdown table as part of the step description. In the allure report the markdown table is automatically included as part of the step name and is presented as a 'wall of text' which is difficult to read for the user.For example:
This is rendered on the Allure report as follows:
The markdown table text is rendered on a single line which makes the descriptive test name (e.g. "I have a customers dataframe") difficult to read as the line is cluttered by the table.
My suggested work around was to add the markdown table as an Text attachment which is easy to read/format and then update the name of the step to remove the markdown table text. For example, just keep the first line -- "I have a customers dataframe".
However, it doesn't seem possible to update the name of the step dynamically as part of the test.
I would be very happy to work on a PR for this.
Please tell us about your environment:
Other information
Here is some example code for the above scenario
The text was updated successfully, but these errors were encountered: