7

これは私のディレクトリ構造です:

composer.json
composer.phar
vendor/
    bin/
        behat
tests/
    functional/
        behat.yml
        features/
            registration.feature
            bootstrap/
                FeatureContext.php

やった:

cd tests/functional
../../vendor/bin/behat --init

それは私にとって基本的な構造を作成しました。これは behat.yml 内にあります。

default:
  paths:
    features: '%behat.paths.base%/features'
    bootstrap:  '%behat.paths.base%/features/bootstrap'

今、私は次のような BDD テストを実行しようとしています:

vendor/bin/behat -c tests/functional/behat.yml

そして私は得る:

  [RuntimeException]                                                       
  Context class not found.                                                 
  Maybe you have provided wrong or no `bootstrap` path in your behat.yml:  
  http://docs.behat.org/guides/7.config.html#paths                         



behat [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [--append-to="..."] [features]

何が問題なのですか?

Composer経由でBehatをインストールしました。これは私のcomposer.jsonです:

{
    "name": "hello",
    "description": "Hello World",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.3",
        "zendframework/zendframework": "2.1.4",
        "doctrine/common": "dev-master#d7987c96675e153638729383577090feed9854f1"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.14",
        "behat/behat": "2.4.*@stable"
    }
}

私がインストールしたもの:

php composer.phar install --dev -o
4

2 に答える 2

3

これがうまくいきました。

cd tests/functional
../../vendor/bin/behat --init
cd ../../
vendor/bin/behat -c tests/functional/behat.yml

この構成ファイルでは:

default:
  paths:
    features: features
    bootstrap: features/bootstrap
于 2013-04-10T15:35:35.797 に答える