如何在黄瓜上识别带有数字 ID 的场景和步骤?
寻找一种很好的方法来识别黄瓜上带有数字 ID 的场景和步骤
- 不想为此使用代码行号,这在编辑功能后可能会发生变化。
- 我已经在使用标签来识别/分组场景,但客户需要一个唯一的编号来引用它们。
- 理想的解决方案会自动处理这个问题,也许是一个具有某种持久性支持的黄瓜宝石。
截至目前,我将简单地使用带有硬编码数字 ID 的标签,例如
@login @tc10100
Scenario: Login with wrong credentials
Given I am not logged in
And I go to the user signin page
#and so on...
关于此临时标记 (@tc10100) 解决方案的注释:
- tc 代表测试用例(客户习惯该术语)
- 10100 只是一些初始案例编号
- 由于设计良好的场景不会包含超过 9 个步骤,因此将自动计算步骤数,从步骤 1、2、3 开始...所以 @tc10100 步骤 2 是“然后我进入用户登录页面”
Looking into a nice approach for identifying scenarios and steps with numerical ids on cucumber
- Don't want to use code line number for this, that can change after editing features.
- I'm already using tags to identify/group scenarios but customer requires a unique number to refer them.
- Ideal solution would take care of this automagically perhaps a cucumber gem with some sort of persistence support.
As of now, i will simply use tags with hard-coded numerical ids on it, e.g.
@login @tc10100
Scenario: Login with wrong credentials
Given I am not logged in
And I go to the user signin page
#and so on...
Notes about this temporary tagged (@tc10100) solution:
- tc stands for Test Case (customer is accustomed to that term)
- 10100 is just some initial case number
- since a good designed scenario will not include more than 9 steps, step numbers will be counted automatically, starting on step 1, 2, 3... So @tc10100 step 2 is "And I go to the user signin page"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里最好的解决方案可能是根据场景名称创建场景 ID。
您对 id 最大长度有任何限制吗?
如果没有,我们可以开始考虑某种场景唯一哈希,将 md5 或类似的东西应用于场景名称。
The best solution here may be create scenarios ids based on the scenario's name.
Do you have a any kind of constraints about the id max length ?
If not we can start thinking about some sort of scenario unique hash applying md5 or something like that to the scenario's name.