From the course: Cucumber Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

More Cucumber expressions

More Cucumber expressions

From the course: Cucumber Essential Training

Start my 1-month free trial

More Cucumber expressions

- [Instructor] Let's do a fun exercise, with regular expressions. How about adding a dollar sign in front of the price in the first scenario step? As soon as this dollar sign is added, this step is flagged as being out of sync and with missing step definition. So I will go ahead and save this. Let's go back to the step definitions and add something that will make this dollar sign optional. So I'm going to add a capture group here and I'm going to add a dollar sign here, and this is going to have zero or more occurrences. Let's go head and save this, go back to menu management close and refresh this, and if everything worked fine that error goes away, in fact I'm going to add a scenario here, and this scenario will test for cucumber salad and in this case instead of putting the dollar sign I'll just put 15, and you can notice that this is no longer flagged. This is because in my regular expressions I have made the dollar sign optional, so it can occur zero or more times. Let me go head…

Contents