Amlesh Anand
Amlesh Anand

Reputation: 21

Can we include () in step definiton of cucumber?

I have a step defined in stepdefinition.java which is

@And(^I wait for \"(.*?)\" min$)

Can we define it as

@And(^I wait for \"(.*?)\" min(s)$)

Upvotes: 2

Views: 1392

Answers (2)

Roman Dornhof
Roman Dornhof

Reputation: 199

Just for the case someone is looking for a solution working with data types on newer versions (from cucumber 4.3.0), you only have to escape the opening bracket like this:

@Then("Waehle die Option {string} \\(ersetze {string} mit {string}) in der Mehrfachauswahlliste {string}")

Upvotes: 1

troig
troig

Reputation: 7212

As it's described in this post, you need to escape the parenthesis with double backquote \\

So, your step definition should be like this:

@And("^I wait for \"(.*?)\" min\\(s\\)$")

Hope it helps

Upvotes: 3

Related Questions