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('/^"([^"]*)
この記事は会員限定です。会員登録をすると続きをお読みいただけます。
ログイン / 新規登録