2016-12-12 86 views
0

林有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,並增加了scenariose形式machine.feature並告訴我,我錯過了然後

+0

您在使用symfony的? – BentCoder

+0

@BentCoder否我不是 –

回答

0

我發現我需要在我的個人資料的配置,現在我的behat.yml看起來添加paths

machine: 
    suites: 
    machine: 
     paths: 
     - %paths.base%/features/machine.feature 
     contexts: 
     - MachineContext: 
location: 
    suites: 
    location: 
     paths: 
     - %paths.base%/features/location.feature 
     contexts: 
     - LocationContext: 
0

你可以從這個例子中得到啓發。根據您的需要調整它。

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