Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories


I am developing a framework for automation using pytest-bdd based framework. Based on functionality I have multiple feature files and multiple step defintion files. Some scenarios take steps from other step definition files.
For example I have a Login Module , User Details Module. Now for validation of a step in User Module I do have to start with steps from the Login Module.
However in python bdd, I could see a one to one mapping of feature and step definition file. Please let me know if this a limitation of pytest bdd framework . question from:https://stackoverflow.com/questions/65921199/how-to-link-feature-file-to-multiple-step-defintion-files-in-python-bdd

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
978 views
Welcome To Ask or Share your Answers For Others

1 Answer

Yes as far as i have worked with pytest bdd, you can only map one step definition to a single feature file, but there are work arounds to these.

1.Use conftest to keep all your common steps that you want to call across multiple feature files. 2.Use methods to be called into other step definitions by importing those methods into other step definitions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...