极长工作流程的 Cucumber 场景
我们需要为一个功能测试一个漫长的步骤过程。从登录到许多模式对话框、多步骤表单以及不同角色的用户都在交互。我们如何将这个过程的各个部分分解为单独的场景?
下面是一个例子:
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"
等等几十个场景。问题是每个场景都是建立在上一个场景之上的。如何单独测试每个场景而不重复前面的所有场景?
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?
Here is an example:
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
场景应该是独立的,因此您可以创建一个设置后台进程,该进程设置一个可以在不同场景中使用的基本手稿:
如果您确实在上一步的基础上构建并且完全依赖于它,那么创建一个单一场景:
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:
If you are really building on the previous step and are entirely dependent upon it, then create a single scenario: