Behat 多个配置文件
Behat multiple profile
我有 behat.yml
看起来像
machine:
suites:
machine:
contexts:
- MachineContext:
location:
suites:
location:
contexts:
- LocationContext:
当我 运行 behat -c behat.yml --profile machine
它 运行 我所有的场景都是正确的,但是当我 运行 behat -c behat.yml --profile location
它 运行 场景 rom location.feature
并添加场景形式 machine.feature
然后告诉我我失踪了
你可以从这个例子中得到启发。根据您的需要进行调整。
default:
extensions:
Behat\MinkExtension:
sessions:
default:
symfony2: ~
Behat\Symfony2Extension:
kernel:
env: test
debug: true
machine:
extensions:
Behat\MinkExtension:
base_url: 'http://machine.domain.com/app_test.php/'
suites:
default:
contexts:
- Path/To/Your/Context/Machine1Context:
- 'constructor parameter if you have any'
- 'and another one'
- 'Path/To/Your/Context/Machine2Context'
type: symfony_bundle
bundle: Whatever1YourBundle
location:
extensions:
Behat\MinkExtension:
base_url: 'http://location.domain.com/app_test.php/'
suites:
default:
contexts:
- 'Path/To/Your/Context/LocationContext'
type: symfony_bundle
bundle: Whatever2YourBundle
或者您可以像这里一样使用 suites
版本:Installing behat3 with composer.json
我发现我需要在我的个人资料配置中添加 paths
,现在我的 behat.yml
看起来像
machine:
suites:
machine:
paths:
- %paths.base%/features/machine.feature
contexts:
- MachineContext:
location:
suites:
location:
paths:
- %paths.base%/features/location.feature
contexts:
- LocationContext:
通过添加以下命令为我工作:
behat -c behat.yml --profile machine --suite=machine
behat -c behat.yml --profile machine --suite=location
我有 behat.yml
看起来像
machine:
suites:
machine:
contexts:
- MachineContext:
location:
suites:
location:
contexts:
- LocationContext:
当我 运行 behat -c behat.yml --profile machine
它 运行 我所有的场景都是正确的,但是当我 运行 behat -c behat.yml --profile location
它 运行 场景 rom location.feature
并添加场景形式 machine.feature
然后告诉我我失踪了
你可以从这个例子中得到启发。根据您的需要进行调整。
default:
extensions:
Behat\MinkExtension:
sessions:
default:
symfony2: ~
Behat\Symfony2Extension:
kernel:
env: test
debug: true
machine:
extensions:
Behat\MinkExtension:
base_url: 'http://machine.domain.com/app_test.php/'
suites:
default:
contexts:
- Path/To/Your/Context/Machine1Context:
- 'constructor parameter if you have any'
- 'and another one'
- 'Path/To/Your/Context/Machine2Context'
type: symfony_bundle
bundle: Whatever1YourBundle
location:
extensions:
Behat\MinkExtension:
base_url: 'http://location.domain.com/app_test.php/'
suites:
default:
contexts:
- 'Path/To/Your/Context/LocationContext'
type: symfony_bundle
bundle: Whatever2YourBundle
或者您可以像这里一样使用 suites
版本:Installing behat3 with composer.json
我发现我需要在我的个人资料配置中添加 paths
,现在我的 behat.yml
看起来像
machine:
suites:
machine:
paths:
- %paths.base%/features/machine.feature
contexts:
- MachineContext:
location:
suites:
location:
paths:
- %paths.base%/features/location.feature
contexts:
- LocationContext:
通过添加以下命令为我工作:
behat -c behat.yml --profile machine --suite=machine
behat -c behat.yml --profile machine --suite=location