Cucumber 和与选择列表的关联
我正在使用 Cucumber 进行记录创建的集成测试。我的功能如下所示:
When I go to the create album page
And I fill in the following:
| Album Title | Great Album |
| Record Label | Decca |
| Catalog Number | 778-B127 |
| Number of Discs | 2 |
| Release Year | 2002 |
| Internal Catalog Number | CD 1662 |
And I press "Add Album"
Then I should see "Great Album was added to the library."
事情是,一个 Album
belongs_to
一个 Composer
。此关联是在新专辑页面上使用下拉列表创建/选择的,该列表填充了现有作曲家
的记录。测试这种关联的最佳方法是什么?我更喜欢在我的 Cucumber 表中执行此操作,但这不可能吗?我是否需要使用工厂(或其他机制)来创建此 Composer,然后将类似内容添加
| Composer | Tallis, Thomas|
到我的表中?
I'm doing integration testing of record creation with Cucumber. My feature looks like this:
When I go to the create album page
And I fill in the following:
| Album Title | Great Album |
| Record Label | Decca |
| Catalog Number | 778-B127 |
| Number of Discs | 2 |
| Release Year | 2002 |
| Internal Catalog Number | CD 1662 |
And I press "Add Album"
Then I should see "Great Album was added to the library."
The thing is, an Album
belongs_to
a Composer
. This association is created/selected on the new album page using a drop-down list that is populated with the records of existing Composers
. What's the best way to test this association? I'd prefer to do it in my Cucumber table, but is that not possible? Do I need to use a factory (or other mechanism) to create this Composer
and then add something like
| Composer | Tallis, Thomas|
to my table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以以类似的方式完成您想要的事情,
将这些步骤添加到您的场景
中
i think you could accomplish what you want in a similar fashion
add these steps to your scenario
the step