MVLS
MVLS

Reputation: 37

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

Upvotes: 0

Views: 686

Answers (1)

Sooraj
Sooraj

Reputation: 585

If you are using cucumber version 4.x.x 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")

Upvotes: 1

Related Questions