Skip to content

Scenario Outlines do not inherit Feature context #408

@edaine

Description

@edaine

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

[x] I have read the contributing guide lines at https://github.com/radish-bdd/radish/blob/master/.github/CONTRIBUTING.md

[x] I have read and respect the code of conduct at https://github.com/radish-bdd/radish/blob/master/.github/CODE_OF_CONDUCT.md

[x] I have searched the existing issues and I'm convinced that mine is new.

Describe the bug
It seems that the Feature Context is not inherited with implementing steps using Scenario Outline but I cannot trace the cause.

Environment and Version

  • OS (incl. terminal and shell used): Windows 10 Enterprise Build 17763, VS Code Integrated Terminal (bash)
  • Python Version: Python 3.8.3
  • radish Version (radish --version): 0.13.2

To Reproduce
I have the following code in terrain.py:

@before.each_feature()
def initialize(feature):
    feature.context.index = 0

In one of the steps implementation, when step.parent.parent.context is invoked:

camera_index=step.parent.parent.context.index

I get the error:

AttributeError: 'Context' object has no attribute 'index'

I tried to print out the following:

print(step.context.__dict__)
print(step.parent.context.__dict__)
print(step.parent.parent.context.__dict__) 

And it yielded these:

{'constants': []}
{'constants': []}
{'constants': []}

Again, I only encounter this when the Scenario uses Scenario Outline and the parent contexts are accessed within the step implementation.

Expected behavior
Contexts created in the Terrain can be normally accessed even if the Scenario is defined as "Scenario Outline".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions