给定,何时,然后(给定,何时,然后,何时,然后)的黄瓜顺序

编程入门 行业动态 更新时间:2024-10-26 03:33:07
本文介绍了给定,何时,然后(给定,何时,然后,何时,然后)的黄瓜顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

作为一个端到端自动化测试人员,我一直认为Given,When,Then语句(在使用Cucumber时合并在Gherkin语言中)应该永远只以1的顺序出现.Given,2,When,3然后.

As an End-to-end Automation Tester I have always assumed that Given, When, Then statements (incorporated in the Gherkin Language when using Cucumber) should only ever appear in the order of 1. Given, 2. When, 3. Then.

即不应进行测试,例如,给定,何时,然后,何时,然后.相反,应遵循给定,何时,仅然后".

i.e. A test should not follow, for example, Given, When, Then, When, Then. And instead should follow Given, When, Then only.

此假设的原因是按照仅对应用程序的一个区域进行测试的单个测试的思路进行的.

The reason for this assumption was along the lines of a single test only testing one area of the application.

但是,我在网络上的一些小黄瓜示例中注意到它们有时使用以下顺序:给定,何时,然后,何时,然后.

However, I noticed on some gherkin examples on the web, that they use the following ordering sometimes: Given, When, Then, When, Then.

有人知道写完那么"后是否回到何时"是可以接受的最佳实践?我赞赏该测试仍然有效,只是想知道这是好还是坏的做法.

Does anyone know if this moving back to Whens after writing a Then is acceptable best practice? I appreciate the test will still work, just wondering if this is good or bad practice.

推荐答案

尽管可以用这种方式编写方案,但这不是最佳实践.我曾经犯过一个错误,它可能导致报告和维护方面的问题.

Although scenarios can be written in that way, it is not best practice. I for one, have made that mistake and it can cause problems in reports and maintenance.

一个原因是何时声明一个动作,然后然后验证该动作的结果.拥有时间-然后两次违反了方案的个别行为.

One reason would be that When declares an action and Then verifies the result of that action. Having When - Then twice goes against the individual behavior of a scenario.

也会使阅读该场景的人感到困惑:)

Can also get confusing for someone who reads the scenario :)

这里有一些关于此的帖子

更多推荐

给定,何时,然后(给定,何时,然后,何时,然后)的黄瓜顺序

本文发布于:2023-11-23 09:05:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620871.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:黄瓜   顺序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!