初期アクションに基づいて Web アプリの UI の複数の変更をテストしたい Gherkin で受け入れテストを作成しています。次に例を示します。
Scenario: Cancel editing a new text asset
Given the user "test_user@fakedomain.com" is logged in
When the user navigates to "/build/"
And the user clicks the "Sandbox" link
And the user inputs "Test story for canceling editing of a new text asset" for the "title" field
And the user inputs "Test User" for the "byline" field
And the user inputs "My summary, so exciting!" for the "summary" textarea
And the user clicks on "Untitled Section" in the section list
And the user clicks the "Text" icon in the "center" container
And the user inputs the following text in the rich text editor:
"""
Test text for asset. This is cool.
"""
And the user clicks the "cancel" button
Then the following text is not present:
"""
Test text for asset. This is cool.
"""
And the "Image" icon is present
And the "Text" icon is present
When the user refreshes the browser
And the user clicks on "Untitled Section" in the section list
Then the following text is not present:
"""
Test text for asset. This is cool.
"""
When the user opens the asset drawer
Then the following text is not present:
"""
Test text for asset. This is cool.
"""
最初のアクションの応答をテストするために、When/Then ステップの複数のグループがあることに注意してください。ステップのほとんどの実装は prefix キーワードを無視しますが、このテストを実行できると確信していますが、さまざまな結果をテストするより良い方法はありますか? 同じセットアップで異なる "Then" ステートメントを使用して複数のシナリオを作成することをお勧めしますか?