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

ruby-on-rails – 黄瓜长度?

发布时间:2020-12-17 03:34:47 所属栏目:百科 来源:网络整理
导读:我正在为多步注册过程创建一个Cucumber测试,并且对于场景步骤的最佳实践有点不确定…… 注册中有4个表格/页面.我应该循环使用Given,When然后在一个场景中有4次或者有更好的方法来组织它吗? 到目前为止,我有…… Scenario: Company UserGiven I am on the re
我正在为多步注册过程创建一个Cucumber测试,并且对于场景步骤的最佳实践有点不确定……

注册中有4个表格/页面.我应该循环使用Given,When&然后在一个场景中有4次或者有更好的方法来组织它吗?

到目前为止,我有……

Scenario: Company User
Given I am on the registration page
When I follow "Register as a supplier"
When I fill in the following:
  | user_email | test@test.com |
  | user_password | secret |
  | user_password_confirmation | secret |
And I press "Create login - Proceed to step 2"
Then I should see "Create Company Profile"
When I fill in the following:
  | company_name | Test Company |
  | company_description | Lorem |
  | company_telephone | 01928740436 |
  | company_email | info@agency.com |
And I press "Create company - Proceed to step 3"
Then I should see "Test Company office(s)"

解决方法

我建议有4个方案,涵盖每个步骤的细节,例如:

Given I am on step 2
When I fill in the following:
  | company_name | Test Company |
  | company_description | Lorem |
  | company_telephone | 01928740436 |
  | company_email | info@agency.com |
And I press "Create company - Proceed to step 3"
Then I should see "Test Company office(s)"

你可以隐藏任何必要但不相关的形式 – 在“鉴于我在第X步”的定义中.

您可能还应该有一个场景,涵盖所有内容如何组合在一起,例如:

When I complete step 1 with valid information
And I complete step 2 with valid information
And I complete step 3 with valid information
And I complete step 4 with valid information
Then I should see "Thank you for registering"

(编辑:李大同)

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

    推荐文章
      热点阅读