Open Jiff21 opened 6 years ago
Any update on above?
@sseliverstov Could you please help with above query? Really need some feature to update the scenario name.
Hi!
I was able to reproduce the issue with both a 2.5.0 and 2.12.0 (the most recent at the time) versions of allure-behave
but it appeared in a slightly different way compared to the OP:
Feature: Reproduce issue 279
Scenario: Scenario to reproduce issue 279
Given Step to reproduce issue 279
steps.py
from behave import given
@given("Step to reproduce issue 279")
def given_step_to_reproduce_issue_279(context):
pass
environment.py
def before_feature(context, feature):
feature.name = "Issue 279 not reproduced for feature"
def before_scenario(context, scenario):
scenario.name = "Issue 279 not reproduced for scenario"
def before_step(context, step):
step.name = "Issue 279 not reproduced for step"
behave -f allure_behave.formatter:AllureFormatter -f pretty -o ./.allure-results/issue279 ./features/issue279.feature
{
"name": "Scenario to reproduce issue 279",
"status": "passed",
"steps": [{
"name": "Given Step to reproduce issue 279",
"status": "passed"
}],
"labels": [{
"name": "feature",
"value": "Issue 279 not reproduced for feature"
}]
}
Looks like allure-behave
picks up a name update from before_feature
as expected, while ignoring one from before_scenario
and before_step
. I will try to fix this later.
If someone has different reproducible behavior, please, post it here.
I took a look at how behave
calls a formatter and environment setup functions. It is poorly documented so the best way to figure it out is to do some observations. Here is the sequence of calls I observed (being applied to allure-behave in particular):
environment.before_feature
environment.before_scenario
environment.before_step
environment.after_step
environment.after_scenario
environment.after_feature
Given this lifecycle, it`s no surprise that the changes are not reflected properly.
To fix that we can update the test`s name
, fullName
and description
in allure_behave.listener.AllureListener.stop_scenario, and the step`s name
in allure_behave.listener.AllureListener.stop_behave_step (by providing a new name to the stop_step
call).
And probably it is better to use formatter`s scenario
function instead of mangling the scenario`s run
function, but that requires additional testing.
@delatrie Hi delatrie, is this bug fixed? I meet the same question in allure-behave(version:2.13.1).
@Rexze001 It's not yet fixed, sorry.
@delatrie It's okay, hope you guys can fix it soon.
I'm submitting a ...
What is the current behavior?
If you include modify a Feature or Scenario description text in Behave's before_feature or before_scenario this is not reflected in the allure result.
Steps:
I've added something like this to my environment.py file
Then running with something like
behave -D server="testing" qa/functional/features/
What is the expected behavior?
The feature should have
on testing environment.
added to it on the allure report. And the scenario should have something likein chrome 68.0.3440.84
appended to the end of the name. Currently the allure report includes the feature and scenario descriptions without the appended information. Behave will include this appended information if I do not run with the formatter.What is the motivation / use case for changing the behavior?
I'm trying to edit the Scenario and feature names without using Tables.
Please tell us about your environment: