如何从黄瓜方案中传递字符串列表

编程入门 行业动态 更新时间:2024-10-27 07:25:14
本文介绍了如何从黄瓜方案中传递字符串列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要传递黄瓜场景中的字符串列表,如下所示工作正常

I need to pass the List of strings from cucumber scenario which works fine as below

Scenario Outline: Verify some scenario Given something When user do something Then user should have some "<data>" Examples: Some example |data| |Test1, Test2, Test3, Test4|

在步骤定义中,我使用List检索某些变量的值.但是当data变量的值之一包含逗号(,)时,例如Tes,t4变得复杂,因为它将"Tes"和"t4"视为两个不同的值

In the step definition I use List to retrieve the values of something variable. But when one of the value of data variable contains comma(,) e.g. Tes,t4 it becomes complex,since it considers "Tes" and "t4" as two different values

Examples: Some example |something| |Test1, Test2, Test3, Tes,t4|

那么我可以使用任何转义字符还是有其他方法来处理这种情况

So is there any escape character that i can use or is there is there any other way to handle this situation

推荐答案

找到了一种简单的方法.请参阅以下步骤.

Found an easy way. Please see the below steps.

  • 这是我的功能文件.

  • Here is my feature file.

这是用于用代码映射要素步骤的相应代码.

Here is the corresponding code to map feature step with code.

哦,是的.结果很重要.您可以看到调试视图.

Oh yes. Result is important. You can see the debug view.

更多推荐

如何从黄瓜方案中传递字符串列表

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

发布评论

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

>www.elefans.com

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