Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make "the" optional in my cucumber BDD Step Definitions?

I'd like to match either of the following BDD:

Then the response status should be "200"
Then response status should be "200"

I want to make "the" optional. I want these two rules to map to the SAME step.

Here is my attempt, but it doesn't work:

@Then("^(?:the | )response status should be \"([^\"]*)\"$")
public void the_response_status_should_be(String arg1) {
    ...
}
like image 681
Katie Avatar asked Sep 02 '25 16:09

Katie


1 Answers

This might work ... "^(?:the )*response status should be \"([^\"]*)\"$"

like image 56
jgauld Avatar answered Sep 07 '25 20:09

jgauld