黄瓜场景,极长的工作流程 [英] Cucumber scenarios for extremely long work flow
问题描述
我们需要测试一个功能的长时间步骤。从登录到许多模式对话框,多步骤表单,和不同角色的用户都互动。
We need to test a long process of steps for one Feature. From logging in to many modal dialogs, multi-step forms, and users of different roles all interacting. How can we break parts of this process down into individual Scenarios?
这里是一个例子:
Scenario: New Manuscript
Given I am on the manuscripts page
When I press "Submit A New Manuscript"
Then I should see "Please specify this manuscript's type"
Scenario: Choose Manuscript Type
Given I am choosing a manuscript type
When I click "Original Paper"
Then I should see "Edit Manuscript Details"
Scenario: Edit Manuscript Details
Given I am editing manuscript details
And I am on the editing page
When I fill in "Manuscript Title" with "Testing Story"
Then I should see "Suggest Reviewers"
等等。问题是每个场景是建立在最后一个。
And so on and so on for dozens of scenarios. The problem is each scenario is built off of the last one. How can I test each scenario in isolation without repeating all of the previous ones?
推荐答案
方案应该是自包含的,因此,您可以创建一个设置后台进程,设置一个基本手稿,您可以在不同的场景中使用:
Scenarios are supposed to be self contained, so you can either create a setup Background process, that setups a basic manuscript that you can use in different scenarios:
Feature: ...
Background:
Given a single manuscript exists
Scenario: ...
Scenario: ...
Scenario: ...
如果你真正构建上一步,完全依赖于它,那么创建一个单独的场景:
If you are really building on the previous step and are entirely dependent upon it, then create a single scenario:
Scenario: Manuscript flow
Given I am on the manuscripts page
When I press "Submit A New Manuscript"
Then I should see "Please specify this manuscript's type"
Given I am choosing a manuscript type
When I click "Original Paper"
Then I should see "Edit Manuscript Details"
Given I am editing manuscript details
And I am on the editing page
When I fill in "Manuscript Title" with "Testing Story"
Then I should see "Suggest Reviewers"
这篇关于黄瓜场景,极长的工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!