我正在 Gherkin 中编写验收测试,我想根据初始操作测试 Web 应用程序 UI 中的多项更改。这是一个例子:
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 步骤,用于测试初始操作的响应。虽然大多数步骤的实现都忽略了前缀关键字,而且我很确定我可以让这个测试运行,但有没有更好的方法来测试不同的结果?使用相同的设置但不同的“Then”语句编写多个场景是否更好?