Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
955 views
in Technique[技术] by (71.8m points)

automation - How to link Feature File to multiple step defintion files in Python BDD


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

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

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...