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
The key moment is that Step isn't an async method, while Execute is. That means the following sequence of actions happens when calling Step:
The callee (a test method) calls Step. Since this is a plain method call, no execution context captured by the CLR at that point.
StartStep modifies the callee's context by creating a new step.
The modified context is captured by the CLR in a task created to run the Execute async method.
When Execute completes, the CLR restores the context captured at step 3. This context becomes a new context of the callee. Note, that in this context the step still exists.
The same considerations apply to other methods that return Task instances. That should be easy to fix though: we just need to make every such method an async one. That makes the CLR capture the context earlier, at the point of a call. The restored context then will not hold the step/fixture.
The text was updated successfully, but these errors were encountered:
- make async Step, Before and After obey .NET's ExecutionContext capturing rules
- refactor CoreStepsHelper to be more testable
- write tests for CoreStepsHelper's Step, Before and After
More tests are needed to fully cover CoreStepsHelper.
Fixes#383Fixed#388
- make async Step, Before and After obey .NET's ExecutionContext capturing rules
- refactor CoreStepsHelper to be more testable
- write tests for CoreStepsHelper's Step, Before and After
More tests are needed to fully cover CoreStepsHelper.
Fixes#383Fixed#388
* allure-xunit: provide default config when allureConfig.json is missing
Fixes#381
* Fix async step/fixture wrapper functions
- make async Step, Before and After obey .NET's ExecutionContext capturing rules
- refactor CoreStepsHelper to be more testable
- write tests for CoreStepsHelper's Step, Before and After
More tests are needed to fully cover CoreStepsHelper.
Fixes#383Fixed#388
* Add async suffix to private step methods
This helps to make distinction more clear to a reader.
I'm submitting a ...
What is the current behavior?
When a task-returning function of Allure.Net.Commons.Steps.CoreStepsHelper is called (either directly, or via NUnit.Allure.Core.StepsHelper or Allure.Xunit.Steps), the step/fixture it creates remains in context after the exit.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Let's consider the following example:
Here two consecutive steps are expected, but nested steps are added instead:
What is the expected behavior?
All step/fixture creating functions must properly close the step/fixture they create including properly removing them from the context.
Please tell us about your environment:
Other information
The overload of
Step
to create a step from an async function has the following definition in Allure.Net.Commons.Steps.CoreStepsHelper:The
Execute
method has the following signature:The key moment is that
Step
isn't an async method, whileExecute
is. That means the following sequence of actions happens when callingStep
:Step
. Since this is a plain method call, no execution context captured by the CLR at that point.StartStep
modifies the callee's context by creating a new step.Execute
async method.Execute
completes, the CLR restores the context captured at step 3. This context becomes a new context of the callee. Note, that in this context the step still exists.The same considerations apply to other methods that return Task instances. That should be easy to fix though: we just need to make every such method an async one. That makes the CLR capture the context earlier, at the point of a call. The restored context then will not hold the step/fixture.
The text was updated successfully, but these errors were encountered: