加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 非常长的工作流程的黄瓜场景

发布时间:2020-12-17 01:18:54 所属栏目:百科 来源:网络整理
导读:我们需要为一个功能测试一个漫长的步骤.从登录到许多模式对话框,多步骤表单和不同角色的用户都可以进行交互.我们如何将这个过程的一部分分解为单独的场景? 这是一个例子: Scenario: New Manuscript Given I am on the manuscripts page When I press "Subm
我们需要为一个功能测试一个漫长的步骤.从登录到许多模式对话框,多步骤表单和不同角色的用户都可以进行交互.我们如何将这个过程的一部分分解为单独的场景?

这是一个例子:

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"

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

解决方法

场景应该是自包含的,因此您可以创建一个设置后台进程,设置一个可以在不同场景中使用的基本手稿:
Feature: ...
  Background:
    Given a single manuscript exists

  Scenario: ...

  Scenario: ...

  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"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读