简体   繁体   English

如何使用java Cucumber将“#”作为特征文件中的有效参数传递

[英]How to pass "#" as a valid parameter in feature file using java cucumber

I have to pass "#" symbol as parameter in feature file.我必须在功能文件中传递“#”符号作为参数。 How to achieve that as # symbol represents comments in feature file如何实现#符号代表功能文件中的注释

If you are using cucumber version 4.xx or above you can use (.*) regular expression in step definition to take any kind of parameters.如果您使用的是 4.xx 或更高版本的 Cucumber,您可以在步骤定义中使用(.*)正则表达式来获取任何类型的参数。

Sample Feature File:示例特征文件:

Scenario: User searches for a character in Search
When The user searches for # in the Search

Sample Step Definition:示例步骤定义:

@When("The user searches for (.*) in the Search")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 Cucumber 功能文件中的场景名称作为 Cucumber 步骤中的参数传递? - How to pass Scenario name from the Cucumber feature file as a parameter in the Cucumber steps? 如何使用 REST assured 将 API 响应中的值存储为全局变量并将其作为 Cucumber 功能文件中的参数传递给另一个 API - How can i store a value as global variable from an API response and pass it to another API as parameter in Cucumber feature file using REST assured TestNG和Cucumber:传入单个功能文件名作为参数 - TestNG & Cucumber: Pass in single feature file name as parameter 如何在java或groovy中解析Cucumber特征文件? - How to parse Cucumber feature file in java or groovy? 如何用java在黄瓜中传递布尔参数? - How to pass a Boolean parameter in cucumber with java? 用Cucumber Java运行功能文件 - Run feature file with cucumber java Java cucumber 无特征文件 - Java cucumber without feature file 如何在 Cucumber 功能文件中传递具有不同数量参数的多个示例 - How to pass multiple examples with different number of parameters in Cucumber feature file 如何将特定的java文件与黄瓜中的特定功能文件进行匹配 - How to match a specific java file with specific feature file in cucumber 黄瓜如何查找功能文件是否已执行? 任何Java方法? - Cucumber how to find if a feature file has executed? Any Java method?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM