Parameters in Behat 3

一世执手 提交于 2019-12-11 11:50:37

问题


I have a website written in PHP with around 40 countries. I started to develop test in Behat v3, with many features. Sometimes, I need to run a feature/suite with a specific country and on a specific server.

For instance, what I have to do is :

php bin/behat --suite=mySuite --env=stg --country=US,IT,CA

Or something like that. For just retrieve URL by the environment and country passed in parameter. I think it's not possible whit Behat and if not, what kind of tool can I use ?

Thanks !


回答1:


Everything that goes beyond bin/behat is Behat specific. So, yes, it's not possible via Behat parameters. This is easily achieved with environment parameters, which you can pass before running the script:

ENV="stg" COUNTRY="US,IT,CA" php bin/behat --suite=mySuite

In your code you retrieve them from the $_SERVER superglobal:

$env     = $_SERVER['ENV'];
$country = $_SERVER['COUNTRY'];


来源:https://stackoverflow.com/questions/26295494/parameters-in-behat-3

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