What is the best way to pass information from one steps def class to another?

ぐ巨炮叔叔 提交于 2019-12-13 07:42:12

问题


Injecting one Steps def into another can rapidly lead to dependency bloat as the amount of re-use among steps defs grows. Furthermore it couples steps defs very tightly to each-other.

There must be a better way. Any suggestions?

Is passing information between steps defs an anti-pattern that should be avoided anyway?


回答1:


If your question is about sharing state between different Step Definition classes, you can do this with Dependency Injection frameworks like Spring. Here's a blog that explains (better than I could paraphrase right here): http://www.thinkcode.se/blog/2017/06/24/sharing-state-between-steps-in-cucumberjvm-using-spring

If you don't want to use Spring, there are other DI frameworks you can use.



来源:https://stackoverflow.com/questions/33713674/what-is-the-best-way-to-pass-information-from-one-steps-def-class-to-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!