简体   繁体   中英

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.

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM