极长工作流程的黄瓜场景黄瓜、工作流程、场景

2023-09-08 00:25:27 作者:い男人不狠灬

我们需要为一个功能测试一个漫长的步骤过程.从登录到许多模式对话框、多步骤表单和不同角色的用户都在交互.我们如何将这个过程的各个部分分解为单独的场景?

这是一个例子:

场景:新手稿鉴于我在手稿页面上当我按下提交新手稿"时然后我应该会看到请注明这份手稿的类型"场景:选择稿件类型鉴于我正在选择一种手稿类型当我点击原稿"时然后我应该看到编辑手稿详细信息"场景:编辑稿件详细信息鉴于我正在编辑手稿细节我在编辑页面当我用测试故事"填写手稿标题"时然后我应该看到建议审稿人"
IPO 到底是什么 为何这么多企业在排队

等几十个场景.问题是每个场景都建立在最后一个场景之上.如何在不重复之前的所有场景的情况下单独测试每个场景?

解决方案

场景应该是自包含的,所以你可以创建一个设置后台进程,设置一个基本的手稿,你可以在不同的场景中使用:

p>特征: ...背景:鉴于存在一份手稿设想: ...设想: ...设想: ...

如果你真的是在上一步的基础上构建并且完全依赖它,那么创建一个单一的场景:

场景:手稿流程鉴于我在手稿页面上当我按下提交新手稿"时然后我应该会看到请注明这份手稿的类型"鉴于我正在选择一种手稿类型当我点击原稿"时然后我应该看到编辑手稿详细信息"鉴于我正在编辑手稿细节我在编辑页面当我用测试故事"填写手稿标题"时然后我应该看到建议审稿人"

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?

解决方案

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"