PHP逆引き大全 516の極意

テストの極意 - Tips513 Behatの使い方

登録タグ
PHP
Icon comment count 0
Icon stock count 0

10-3ビヘイビア駆動開発(BDD)Tips513 Behatの使い方

Level2

Pointフューチャーファイルからステップファイルを作成する

それではBehatの基本的な使い方を見ていきましょう。フィーチャファイルがリスト1です。このファイルを引数としてBehatを実行します。

%> /usr/local/lib/php/Behat/bin/behat.php 513_1.feature[Enter]
Feature: 正規ユーザのみログインを許可したい
  Scenario: ユーザのログイン              # 513_1.feature:3
    Given ログイン画面が表示されている 
    And "login"に"shuwa"と入力する
    And "password"に"system"と入力する
    When loginとpasswordの組み合わせが正しい
    Then "ログイン成功"と表示される
1 scenario (1 undefined)
5 steps (5 undefined)
0m0.021s
You can implement step definitions for undefined steps with these snippets:
$steps->Given('/^ログイン画面が表示されている $/', function($world) {
    throw new \Behat\Behat\Exception\Pending();
});
$steps->And('/^"([^"]*)

出典情報

Medium

PHP逆引き大全 516の極意

  • 著者: 大家 正登, 茂木 健一, 鮫島 康浩, 谷中 志織

コメント

    コメントはありません