I am trying to pass a dictionary from a feature file to my test file. I searched a lot but couldnt find a way to pass a dictionary.
Below is one example that is available in behave which I wanted to achieve in pytest-bdd
Reference link: How can I pass an object like a list or dictionary in python behave .feature file
Please let me know if someone already have a solution for the same.
Thank you.
Scenario Outline: Dictionary
Given Access Dictionary list
[
{ "abc":"test1","def":"test2"},{ "ghi":"test3","jkl":"test4"}
]
Test file:
@given(parsers.parse('Access Dictionary list\n{table_data:json}', extra_types=dict(json=json.loads)), target_fixture="mytabledata")
def step_setup(table_data):
global data
MyTableData = UserList(table_data)
#print(MyTableData)
print(MyTableData[1]["ghi"])
HAPPY THAT I AM ABLE TO DO IT ON MY OWN :)