是否可以在多行上写一个小黄瓜步骤? [英] Is it possible to write a gherkin step on multiple lines?

查看:188
本文介绍了是否可以在多行上写一个小黄瓜步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是小黄瓜语言的新手,在我看来这是一个非常基本的问题,但我找不到答案。

I am new to the Gherkin language and this seems to me like very basic question but I could not find answer to it.

我知道这是可能的在Gherking中编写多行步进参数,如下所示:

I am aware that it is possible to write multi-line step argument in Gherking, like this:

Given a blog post named "Random" with Markdown body
  """
  Some Title, Eh?
  ==============
  Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet,
  consectetur adipiscing elit.
  """

我的问题是关于在多行上编写单个步骤,就像这样:

My question is about writing single step on multiple lines, something like this:

Given that Gherkin language allows me to write my step definitions \
   on multiple lines
Then my test cases would be easier to read :)

在上面的示例中,我使用 \作为行连续符号。顺便说一句,我尝试了上面的示例,并得到了解析器错误。

In the example above I used '\' as line continuation symbol. BTW, I tried the example above and got parser error.

推荐答案

您尝试了并获得了解析错误。我假设在单行上写长行不会给您一个解析错误。因此,您已经回答了自己的问题。

You tried and got a parse error. I assume that writing the long line on a single line did not give you a parse error. You have therefore answered your own question with no.

我想建议您问问自己为什么行必须很长。所需的行为,是否真的需要太多细节,以致生产线变得很长?

I would like to suggest that you ask yourself why the lines has to be long. The wanted behaviour, does it really need so many details that the line gets very long?

通常可以通过改写句子来表达自我。您还可以使用Gherkin关键字And或But来打破长句子。

It is often possible to express your self shorter by rephrasing a sentence. It is also possible that you could break the long sentence by using the Gherkin keywords And or But.

这篇关于是否可以在多行上写一个小黄瓜步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆