首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Behat多重轮廓

Behat多重轮廓
EN

Stack Overflow用户
提问于 2016-12-12 06:02:23
回答 3查看 895关注 0票数 0

我有behat.yml,看上去像

代码语言:javascript
运行
复制
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,并告诉我我丢失了

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2016-12-13 12:04:29

我发现我需要在我的配置文件中添加paths,现在我的behat.yml看起来像

代码语言:javascript
运行
复制
machine:
  suites:
    machine:
      paths:
        - %paths.base%/features/machine.feature
      contexts:
        - MachineContext:
location:
  suites:
    location:
      paths:
        - %paths.base%/features/location.feature
      contexts:
        - LocationContext:
票数 0
EN

Stack Overflow用户

发布于 2016-12-13 10:42:46

你可以从这个例子中得到启发。根据你的需要调整它。

代码语言:javascript
运行
复制
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版本,如下所示:用behat3安装composer.json

票数 0
EN

Stack Overflow用户

发布于 2018-08-08 07:17:06

通过添加以下命令为我工作:

代码语言:javascript
运行
复制
behat -c behat.yml --profile machine --suite=machine

behat -c behat.yml --profile machine --suite=location
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41094981

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档