From the course: Behavior-Driven Development
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Add a second scenario - Cucumber Tutorial
From the course: Behavior-Driven Development
Add a second scenario
- [Narrator] Now I can finish the job by using the same logic to continue implementing steps. Back inside of our card minimum feature, we have one scenario, that the total charge is over the $2 credit card minimum. Well, we have another scenario that our three amigos came up with. Copying and pasting this inside of the same feature file, we can state that we'd like to set up a scenario where the total charge is under the $2 credit card minimum. We could say, given that Maria orders $1 of coffee from Li, when Maria pays with a credit card, then Li should not process the payment. Notice that our given and when statements are the same for both of our scenarios, meaning that we've already implemented two of the step definitions that we need. Running Cucumber, it shows that we only have one undefined step. Then, I can copy and paste this into my step definitions. Now, I can start making assertions about what I would expect in this converse situation. I can simply copy and paste the expect…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.