[英]How to setup environment variables with behave (Python BDD framework)?
So our test environments dynamically change depending on the release that we are working on.因此,我们的测试环境会根据我们正在处理的版本动态变化。
For example:例如:
With this being said, I need to specify on which URL I would like my tests to be executed using behave BDD framework for Python.话虽如此,我需要指定我希望使用 Python 的行为 BDD 框架在哪个 URL 上执行我的测试。
To be specific Im looking for the equivalent functionality that cucumber has for Ruby using: features/support/env.rb file to define multiple URL (qa, staging, production, etc) so that on the command-line (terminal) I would just say xyz (having qa = feature(the release).mycompany.com具体来说,我正在寻找黄瓜对 Ruby 具有的等效功能,使用: features/support/env.rb 文件来定义多个 URL(qa、暂存、生产等),以便在命令行(终端)上我只需要说 xyz(有 qa = 功能(发布)。mycompany.com
Something like: How can I test different environments (eg development|test|production) in Cucumber?类似于: 如何在 Cucumber 中测试不同的环境(例如开发|测试|生产)?
Ok, so for this there is a Pull Request (PR #243) to be able to do this in behave's github repo.好的,为此有一个拉取请求(PR #243)可以在行为的 github 存储库中执行此操作。
In the meantime as a workaround they suggested me to use os.getenv('variable_name', 'default_value')
, and then at the command line I would just say export variable_name='another_value' ; behave
与此同时,作为一种解决方法,他们建议我使用
os.getenv('variable_name', 'default_value')
,然后在命令行中我只想说export variable_name='another_value' ; behave
export variable_name='another_value' ; behave
Please see more detailed on this on our short thread:请在我们的简短主题中查看更多详细信息:
https://github.com/behave/behave/issues/250 https://github.com/behave/behave/issues/250
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.