If a method takes dictionary as parameter, how to pass it. Do we need to construct the dictionary from values present in feature file and pass internally to the method. Is there any direct way we can pass objects?
Asked
Active
Viewed 540 times
0
-
If understood your question, and I hope I miss understood it, do you mean to do something like that?: def foo(bar): print bar foo({"a":1, "b":2, "c": {"d":4}}) {'a': 1, 'c': {'d': 4}, 'b': 2} – Yonatan Kiron Feb 27 '17 at 14:43
-
Yes correct. so bar is dict object – bhasker Feb 28 '17 at 09:58
-
In python, you can pass as argument to a method whatever you want. – Yonatan Kiron Feb 28 '17 at 14:02
-
pretty confused. so what is your question about 'python-behave'? Do you mean that when behave is executing with your feature file, you wanna some steps to be run with parameters? – Chong Mar 04 '17 at 00:53
1 Answers
0
As far as I know, you can't pass objects in features, but you can send text and tables in the feature file. The text you send can be exploited to send JSON string of your dict/lists and further create objects using that data in step definition.

lumos42
- 106
- 8