“ behat”下无法识别的选项“ suites”

Potney Switters

我正在使用behat 2.4(stable),并且试图将参数传递给扩展BehatContext类,构造函数的类。但是,我得到了“ behat”下的“无法识别的选项” suites”,并进行了以下设置。

我正在使用以下behat.yml文件:

default:
  suites:
    default:
      contexts:
        exampleContext:
          browser: http://localhost:8080
          browser_version: /var/tmp
  paths:
    features: %behat.paths.base%/../../
    bootstrap: %behat.paths.base%/../../
  extensions:   
    Behat\MinkExtension\Extension:
       # base_url is the URL to your dev site. Make sure you include
       # the port at the end. e.g.
       base_url: http://example.web01.com
       default_session: selenium2
       browser_name: 'chrome'
       selenium2:                    
         capabilities: { "browser": "firefox", "version": "14"}
       sites/all/libraries/extensions/DrupalBehatExtension.php: ~
  filters:
    # The default profile does not rebuild from nothing so do not run tests
    # that require a rebuild from nothing.
    tags: ~@require-rebuild
  context:
    class: DrupalContext
    parameters:
      # If you'd like to test on a clone of the actual site data set to true.
      use_test_database: false
      # If an existing test database exists then it will be used unless reset_database is set to true.
      reset_database: false
      # If you would like to clear the db and run site install on every feature
      # set to the name of an install profile, otherwise set to false.
      # If you do set this you should also set use_test_database to true.
      rebuild_on_feature: false
      # If you would like to enable a module after running site install
      rebuild_module: false
      # Set the name of the site folder to use for settings.php.
      site: dev.example.com

我的课堂实现是

class exampleContext extends BehatContext {


public function __construct($browser = 'ie', $browser_version = '8') {
  ...
}

我怎样才能做到这一点?我发现的唯一答案是要求删除DrupalContext的答案,这很重要。

如何从Behat.yml将参数获取到php文件?

BentCoder

试试这个。这是给Behat 2而不是3的!

mySymfonyProject / composer.json:

"require": {
    "behat/behat": "2.5.*@stable",
    "behat/behat-bundle": "1.0.0",
    "behat/symfony2-extension": "1.1.2",
    "behat/mink": "1.5.0",
    "behat/mink-extension": "~1.3",
    "behat/mink-selenium2-driver": "1.1.1",
    "behat/mink-goutte-driver": "1.0.9"
},
"config": {
    "bin-dir": "bin"
},
"minimum-stability": "dev",

behat.yml

default:
    context:
        class: FeatureContext
        parameters:
            browser: 'ie'
            browser_version: '8'
    extensions:
        Behat\Symfony2Extension\Extension:
            mink_driver: true
            kernel:
                env: test
                debug: true
        Behat\MinkExtension\Extension:
            base_url: 'http://mysymfonyproject.local/app_test.php/'
            javascript_session: selenium2
            browser_name: firefox
            goutte: ~
            selenium2: ~
    paths:
        features: %behat.paths.base%/src
        bootstrap: %behat.paths.features%/Context

语境特征

mySymfonyProject / src / Site / CommonBundle / Features / Context / FeatureContext.php

<?php

namespace Site\CommonBundle\Features\Context;

use Behat\MinkExtension\Context\MinkContext;

class FeatureContext extends MinkContext
{
    public function __construct($browser, $browser_version)
    {
        // Do whatever you wish with params
    }

    //And your own methods
}

测试

当您具有功能文件时,可以像这样运行它们(一次运行。有关更多信息,请阅读behat doc):

bin/behat @SiteCommonBundle

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

“ fos_user”下的无法识别的选项“ resource”

Avconv无法识别的选项

无法在openshift 3.11中更新节点导出器的tls-cipher-suites

gcc:错误:无法识别的选项--wrap

Eclipse:无法识别的选项:-g

Eclipse无法识别的选项:-Xincgc

教义缓存无法识别的选项错误

Boost:位置参数无法识别的选项

Kafka无法识别的VM选项'PrintGCDateStamps'

Git - rm:无法识别的选项`--cached'

phpunit回复无法识别的选项--env

MongoDB:“无法识别的选项:systemLog”

在发布模式下使用rustc编译时,出现“无法识别的选项'发布'”

sonata_notification.consumers下的无法识别的选项swift_mailer错误

“lopi_pusher”下无法识别的选项“scheme、cluster、url”

framework.http_client下的symfony 5.2无法识别的选项'http_version'

Symfony配置:Doctrine InvalidConfigurationException:“ doctrine.dbal”下的无法识别的选项“ options”

“ hwi_oauth”下的无法识别的选项“ firewall_name”

“fos_elastica.indexes.app.types.user”下无法识别的选项“mappings”

Symfony2“ security.providers.chain_provider”下的无法识别的选项“ providers”

Symfony - (1/1) InvalidConfigurationException - “framework”下无法识别的选项“mailer”

无法识别的WebSocket连接选项`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase ......是要放在“标头”下吗?

尽管启用了csrf,但“ security.firewalls.main.form_login”下的无法识别的选项“ csrf_provider”

Logstash无法识别的国家/地区VM选项'UseParNewGC'

wget:Windows上无法识别的选项`--no-check-certificate'

ffmpeg返回'frame_pts'作为无法识别的选项

如何在Linux中grep'---'?grep:无法识别的选项'-

无法识别的选项:--print-module-descriptor

Intellij IDEA:无法识别的 VM 选项“UseConcMarkSweepGC”