【发布时间】:2011-05-16 15:38:20
【问题描述】:
我正在为多步骤注册过程创建 Cucumber 测试,但对场景步骤的最佳实践有点不确定...
注册中有4个表格/页面。我应该在一个场景中循环通过 Given、When 和 Then 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)"
【问题讨论】:
-
如果这实际上不是狡猾的影射,我会非常失望。
-
这篇文章的标题让我笑了:)
-
这对我来说看起来不错,但如果它是我的代码,我可能会将所有表单位提取到一个步骤定义中,并且更通用,例如:“当我设置我的电子邮件和密码”和“当我填写我的公司信息”
-
This 应该会有所帮助。
标签: ruby-on-rails testing cucumber